FourKeysの
この
何か
Actionは
send-deployment-frequency-action/.github/actions/send-deployment-frequency/action.yml at main · kemsakurai/send-deployment-frequency-action
GitHubの
name: 'Send realease info' description: 'Sends release information to the specified WebHookURL. The purpose is to record the deployment frequency of Four Keys.' inputs: web-hook-url: description: 'Web hook URL to which release information will be sent' required: false default: 'https://httpbin.org/post' github-token: description: 'GitHub token' required: true runs: using: "composite" steps: - name: Get release info and Post Data shell: bash env: GITHUB_TOKEN: ${{ inputs.github-token }} run: | gh api graphql -f id="${{ github.event.release.node_id }}" -f query=' query ($id: ID!) { node(id: $id) { ... on Release { id author { login } description isDraft isPrerelease databaseId name repository { name } resourcePath updatedAt publishedAt createdAt tag { name } tagCommit { additions deletions } tagName url } } }' | jq -r '.data.node | { id: .id, user: .author.login, description: .description, isDraft: .isDraft, isPrerelease: .isPrerelease, databaseId: .databaseId, name: .name, repositoryName: .repository.name, resourcePath: .resourcePath, publishedAt: .publishedAt, updatedAt: .updatedAt, createdAt: .createdAt, additions: .tagCommit.additions, deletions: .tagCommit.deletions, tagName: .tagName, url: .url } | @json' | curl '${{ inputs.web-hook-url }}' -X POST -H 'accept: application/json' -H 'Content-Type: application/json' -d @-
GitHub Webhookでの
送信する
際の 条件を 詳細に 絞り込むことができる。 Webhookも 送信条件を 絞り込むことは できますが、 GitHub Actionよりも 大雑把な 指定しかできません。 フラットな
JSONと して 情報を 送信できる。
Webhook のイベントと ペイロード - GitHub Docs に 記載が ありますが、 GitHubの Webhookからの 送信情報は JSONの ネストが 深いです。 Slackの Webhookは、 第1階層までの ネストが 浅い 情報しか 受け取る ことができません。
mixcloud-java-api/.github/workflows/send-release-info.yml at master · kemsakurai/mixcloud-java-api
Composit Actionを
on: release: types: - published jobs: send-release-info: runs-on: ubuntu-latest steps: - name: Get release info and Post Data uses: kemsakurai/send-deployment-frequency-action/.github/actions/send-deployment-frequency@main with: web-hook-url: 'https://httpbin.org/post' github-token: ${{ secrets.GITHUB_TOKEN }}
情報の'https://httpbin.org/post'
に
- 実際利用する
ときに 考慮が 必要な ところ
変更失敗率の記録を 考えると、 リリース情報の 説明欄に あらかじめpull requestの 情報を 特定の 記法で 記入して おいて、 情報を 受け 取った 後の 処理で、 Descriptionを パースして 失敗デプロイに フラグを 立てるなどの 処理が 必要に なりそうに 思いました。
以上です。
コメント