A collection of GitHub Actions to measure and send Four Keys metrics (DevOps performance indicators) to any WebHook URL endpoint.
This repository provides three GitHub Actions to collect and send the Four Keys metrics:
- Deployment Frequency - How often you deploy to production
- Lead Time for Changes - Time from code commit to production deployment
- Time to Restore Service - Time to recover from failures
- Change Failure Rate - Percentage of deployments that cause failures
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 accessweb-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
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 accessweb-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)
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 accessweb-hook-url(optional): WebHook URL endpoint (default:https://httpbin.org/post)web-hook-token(optional): Authentication token for webhookpullrquest-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)
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 }}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 }}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 }}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...export GITHUB_TOKEN=your_github_token_here
cd .github/actions/send-issue
python cli.py send_issue_info <ISSUE_NODE_ID> <WEBHOOK_TOKEN>- Python 3.10+ (for send-issue action)
- GitHub CLI (
gh) (for GraphQL queries) jq(for JSON processing)curl(for HTTP requests)
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...
}- Fork the repository
- Create a feature branch
- Make your changes
- Test your changes
- Submit a pull request
This project is open source and available under the MIT License.