Skip to content

GitHub Action Template to send GitHub release tag information to any WebHook URL endpoint.

Notifications You must be signed in to change notification settings

kemsakurai/action-fourkeys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Four Keys Metrics GitHub Actions

A collection of GitHub Actions to measure and send Four Keys metrics (DevOps performance indicators) to any WebHook URL endpoint.

Overview

This repository provides three GitHub Actions to collect and send the Four Keys metrics:

  1. Deployment Frequency - How often you deploy to production
  2. Lead Time for Changes - Time from code commit to production deployment
  3. Time to Restore Service - Time to recover from failures
  4. Change Failure Rate - Percentage of deployments that cause failures

Actions

1. Send Deployment Frequency (send-deployment-frequency)

Captures release information to measure deployment frequency.

Triggered on: release events

Inputs:

  • web-hook-url (optional): WebHook URL endpoint (default: https://httpbin.org/post)
  • github-token (required): GitHub token for API access
  • web-hook-token (optional): Authentication token for webhook

Data sent:

  • Release ID, name, tag name
  • Author information
  • Repository name
  • Publication/creation timestamps
  • Code changes (additions/deletions)
  • Draft/prerelease status

2. Send Pull Request Info (send-pull-request)

Captures pull request information to measure lead time for changes.

Triggered on: pull_request events (when merged)

Inputs:

  • web-hook-url (optional): WebHook URL endpoint (default: https://httpbin.org/post)
  • github-token (required): GitHub token for API access
  • web-hook-token (optional): Authentication token for webhook

Data sent:

  • Pull request title, URL, author
  • Base and head branch names
  • First commit timestamp
  • Creation, review, and merge timestamps
  • Code changes (additions/deletions)

3. Send Issue Info (send-issue)

Captures issue information to measure time to restore service and change failure rate.

Triggered on: issues events (when closed)

Inputs:

  • github-token (required): GitHub token for API access
  • web-hook-url (optional): WebHook URL endpoint (default: https://httpbin.org/post)
  • web-hook-token (optional): Authentication token for webhook
  • pullrquest-identification-string (optional): String to identify pull request URL that caused the failure (default: **■ 不具合混入pull requests URL** >)
  • failure-date-identification-string (optional): String to identify failure datetime (default: **■ 障害発生日時** >)
  • failure-resolution-date-identification-string (optional): String to identify failure resolution datetime (default: **■ 障害解消日時** >)

Data sent:

  • Issue details (title, body, author, labels, state)
  • Timestamps (created, updated, closed)
  • Extracted failure information:
    • Pull request that caused the bug
    • Failure occurrence time
    • Failure resolution time
    • Time to restore service (calculated)

Usage

Workflow Examples

Deploy Frequency Measurement

name: Track Deployment Frequency
on:
  release:
    types: [published]

jobs:
  track-deployment:
    runs-on: ubuntu-latest
    steps:
      - uses: kemsakurai/send-deployment-frequency-action/.github/actions/send-deployment-frequency@main
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          web-hook-url: ${{ secrets.WEBHOOK_URL }}
          web-hook-token: ${{ secrets.WEBHOOK_TOKEN }}

Lead Time Measurement

name: Track Lead Time
on:
  pull_request:
    types: [closed]

jobs:
  track-lead-time:
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    steps:
      - uses: kemsakurai/send-deployment-frequency-action/.github/actions/send-pull-request@main
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          web-hook-url: ${{ secrets.WEBHOOK_URL }}
          web-hook-token: ${{ secrets.WEBHOOK_TOKEN }}

Failure Recovery Time Measurement

name: Track Recovery Time
on:
  issues:
    types: [closed]

jobs:
  track-recovery:
    runs-on: ubuntu-latest
    steps:
      - uses: kemsakurai/send-deployment-frequency-action/.github/actions/send-issue@main
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          web-hook-url: ${{ secrets.WEBHOOK_URL }}
          web-hook-token: ${{ secrets.WEBHOOK_TOKEN }}

Issue Format for Failure Tracking

To properly track failure recovery metrics, structure your issue body with these identifiers:

## Failure Report

**■ 不具合混入pull requests URL** > https://github.com/owner/repo/pull/123

**■ 障害発生日時** > 2024-01-15T10:30:00Z

**■ 障害解消日時** > 2024-01-15T14:45:00Z

## Description
Details about the failure...

Local Testing

Issue Info Testing

export GITHUB_TOKEN=your_github_token_here
cd .github/actions/send-issue
python cli.py send_issue_info <ISSUE_NODE_ID> <WEBHOOK_TOKEN>

Requirements

  • Python 3.10+ (for send-issue action)
  • GitHub CLI (gh) (for GraphQL queries)
  • jq (for JSON processing)
  • curl (for HTTP requests)

Data Format

All actions send JSON data to the specified webhook URL with the following common structure:

{
  "type": "deployment|pull_request|issue",
  "webHookToken": "your-token",
  "repository": "repo-name",
  // Action-specific data...
}

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test your changes
  5. Submit a pull request

License

This project is open source and available under the MIT License.

About

GitHub Action Template to send GitHub release tag information to any WebHook URL endpoint.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published