Slack 通知を手動でテストするワークフローを追加 - #36
Merged
Merged
Conversation
scheduler_daily.yml の Slack 通知ステップは if: failure() 条件のため、 日次ビルドが失敗しない限り発火せず動作確認ができない。 slackapi/slack-github-action を v1 から v3 に上げた際も未検証のままだった。 通知ステップだけを workflow_dispatch で手動実行できるようにしたので、 副作用なしで疎通確認できる。今後 Slack Action を上げる際にも使える。 gh workflow run test_slack_notification.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
課題
scheduler_daily.ymlの Slack 通知ステップはif: failure()条件のため、日次ビルドが失敗しない限り発火せず、動作確認ができません。先日slackapi/slack-github-actionを v1.24.0 → v3.0.5 に上げた際も(webhook の指定方法に破壊的変更があったにもかかわらず)未検証のままでした。つまり「次にビルドが壊れたとき、通知が飛ばないことに初めて気づく」という状態です。通知の設定ミスは、一番通知が必要なタイミングで発覚するのが最悪です。
解決
通知ステップだけを
workflow_dispatchで手動実行できる小さなワークフローを追加しました。[TEST]を付け、エラー通知と区別できるようにしています代替案として検討したもの
scheduler_daily.ymlにworkflow_dispatchのテスト入力を足す案もありましたが、通知を試すたびに日次ジョブ全体(API 取得・ビルド・main へのコミット・GitHub Pages デプロイ)が走ってしまい副作用が大きいため、独立したワークフローにしました。注意点
scheduler_daily.ymlの Slack ステップと同じ設定を保つ必要があります(片方だけ変更するとテストの意味がなくなる)。その旨をワークフローのコメントに明記しました。確認方法
workflow_dispatchは default branch にファイルがないと実行できないため、マージ後に上記コマンドで実行し、Slack にメッセージが届くことを確認します。