0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【GitHub+Slack】自作メッセージでPRマージをSlackで通知

Last updated at Posted at 2025-07-03

はじめに

プルリクをマージした際にSlackで通知したい。
SlackにはGitHub公式アプリ(GitHub App)があるが通知メッセージのカスタマイズができないっぽいため今回はGitHubActionsを用いてSlackに送信する方法。

GitHub公式アプリ(GitHub App)での通知の参考記事はこちら

【Slack】GitHubと連携してPushやPRなどの通知を受け取れるようにしよう
GitHubとSlackを連携してみた

対応

以下のようなメッセージで投稿する想定
image.png

手順

1. SlackのWebhook URLを取得

  • Slackで通知を送りたいチャンネルを作成
  • Appを追加Incoming Webhooksを選択
  • WebhookURLを発行してコピーしておく
    スクリーンショット 2025-06-18 223722.png

2. GitHubにSecretを登録

  • GitHubで対象リポジトリ開く
  • Settings → Secrets and variables → Actions → New repository secretをクリック
    • Name:SLACK_WEBHOOK_URL
    • Value:Slackで発行したWebhook URL
      スクリーンショット 2025-06-18 225010.png

3. Workflowファイルを作成

github/workflows/pr-merged-slack.ymlという名前で以下を作成

その後適当にプルリク作成してマージするとSlackに通知が行くはず。
 

補足

プルリクの情報はほかにもとれるので下記を参照。
https://docs.github.com/en/webhooks/webhook-events-and-payloads#pull_request

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?