Skip to content

Commit 99bb232

Browse files
authored
Merge pull request #36 from coderdojo-japan/add-slack-notification-test
Slack 通知を手動でテストするワークフローを追加
2 parents 9261be7 + 4c1de21 commit 99bb232

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Test Slack Notification
2+
3+
# scheduler_daily.yml の Slack 通知ステップは `if: failure()` 条件のため、
4+
# 日次ビルドが失敗しない限り発火せず、動作確認ができない。
5+
# このワークフローは通知ステップだけを手動実行できるようにしたもの。
6+
# slackapi/slack-github-action をアップグレードした際の疎通確認に使う。
7+
#
8+
# 実行方法:
9+
# gh workflow run test_slack_notification.yml
10+
#
11+
# 注意: scheduler_daily.yml の Slack ステップと同じ設定を保つこと。
12+
# 片方だけ変更すると、このテストの意味がなくなる。
13+
on:
14+
workflow_dispatch:
15+
16+
jobs:
17+
notify:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: 🔔 Send a test message to Slack
22+
uses: slackapi/slack-github-action@v3.0.5
23+
with:
24+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
25+
webhook-type: incoming-webhook
26+
27+
# scheduler_daily.yml と同じ形式のペイロード(文面のみテスト用)
28+
payload: |
29+
{
30+
"text": "[TEST] DojoMap の Slack 通知テストです。(詳細を見る)",
31+
"blocks": [
32+
{
33+
"type": "section",
34+
"text": {
35+
"type": "mrkdwn",
36+
"text": "[TEST] DojoMap の Slack 通知テストです。エラー通知ではありません。(<https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|詳細を見る>)"
37+
}
38+
}
39+
]
40+
}

0 commit comments

Comments
 (0)