Skip to content

Commit 0fc31e2

Browse files
authored
chore: split notify_slack into separate workflows
- notify-issues.yml: issue notifications - notify-pr.yml: pull request notifications - notify-release.yml: callable workflow for release notifications - release_maven.yml: call notify-release after successful publish
1 parent 21cafbc commit 0fc31e2

5 files changed

Lines changed: 84 additions & 39 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Notify Slack - Issues
2+
3+
on:
4+
issues:
5+
types: [opened, reopened]
6+
7+
permissions: {}
8+
9+
jobs:
10+
notify:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Send issue notification to Slack
14+
uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
15+
with:
16+
webhook: ${{ secrets.SLACK_WEBHOOK_URL_ISSUE }}
17+
webhook-type: incoming-webhook
18+
payload: |
19+
{
20+
"action": "${{ github.event.action }}",
21+
"issue_url": "${{ github.event.issue.html_url }}",
22+
"package_name": "${{ github.repository }}"
23+
}

.github/workflows/notify-pr.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Notify Slack - Pull Requests
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened, ready_for_review]
6+
7+
permissions: {}
8+
9+
jobs:
10+
notify:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Send pull request notification to Slack
14+
if: github.event.pull_request.draft == false
15+
uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
16+
with:
17+
webhook: ${{ secrets.SLACK_WEBHOOK_URL_PR }}
18+
webhook-type: incoming-webhook
19+
payload: |
20+
{
21+
"action": "${{ github.event.action }}",
22+
"pr_url": "${{ github.event.pull_request.html_url }}",
23+
"package_name": "${{ github.repository }}"
24+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Notify Slack - Release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
tag_name:
7+
required: true
8+
type: string
9+
release_url:
10+
required: true
11+
type: string
12+
13+
permissions: {}
14+
15+
jobs:
16+
notify:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Send release notification to Slack
20+
uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
21+
with:
22+
webhook: ${{ secrets.SLACK_WEBHOOK_URL_RELEASE }}
23+
webhook-type: incoming-webhook
24+
payload: |
25+
{
26+
"tag_name": "${{ inputs.tag_name }}",
27+
"release_url": "${{ inputs.release_url }}",
28+
"package_name": "${{ github.repository }}"
29+
}

.github/workflows/notify_slack.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/release_maven.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,11 @@ jobs:
103103
uses: ad-m/github-push-action@4cc74773234f74829a8c21bc4d69dd4be9cfa599 # master
104104
with:
105105
github_token: ${{ secrets.GITHUB_TOKEN }}
106+
107+
notify-release:
108+
needs: [release]
109+
uses: ./.github/workflows/notify-release.yml
110+
with:
111+
tag_name: v${{ github.event.inputs.release_version }}
112+
release_url: ${{ github.server_url }}/${{ github.repository }}/releases/tag/v${{ github.event.inputs.release_version }}
113+
secrets: inherit

0 commit comments

Comments
 (0)