Skip to content

Commit 92809ce

Browse files
committed
Migrate slack notifications to GChat (2nd attempt)
Closes gh-15503
1 parent 097c927 commit 92809ce

File tree

5 files changed

+48
-55
lines changed

5 files changed

+48
-55
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
workflow_dispatch: # Manual trigger
1010

1111
env:
12-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
1312
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
1413
COMMIT_OWNER: ${{ github.event.pusher.name }}
1514
COMMIT_SHA: ${{ github.sha }}
@@ -209,26 +208,11 @@ jobs:
209208
run: |
210209
echo "Tagging and publishing $REPO@$VERSION release on GitHub."
211210
./gradlew createGitHubRelease -PnextVersion=$VERSION -Pbranch=$BRANCH -PcreateRelease=true -PgitHubAccessToken=$TOKEN
212-
- name: Announce Release on Slack
213-
id: spring-security-announcing
214-
uses: slackapi/[email protected]
215-
with:
216-
payload: |
217-
{
218-
"text": "spring-security-announcing `${{ env.VERSION }}` is available now",
219-
"blocks": [
220-
{
221-
"type": "section",
222-
"text": {
223-
"type": "mrkdwn",
224-
"text": "spring-security-announcing `${{ env.VERSION }}` is available now"
225-
}
226-
}
227-
]
228-
}
211+
- name: Announce Release on GChat
229212
env:
230-
SLACK_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_SLACK_WEBHOOK_URL }}
231-
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
213+
WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_GCHAT_WEBHOOK_URL }}
214+
run: |
215+
curl -X POST '${{ env.WEBHOOK_URL }}' -H 'Content-Type: application/json' -d '{ "text": "spring-security-announcing `${{ env.VERSION }}` is available now" }' || true
232216
- name: Setup git config
233217
run: |
234218
git config user.name 'github-actions[bot]'
@@ -260,20 +244,13 @@ jobs:
260244
distribution: 'adopt'
261245
- name: Schedule next release (if not already scheduled)
262246
run: ./gradlew scheduleNextRelease -PnextVersion=$VERSION -PgitHubAccessToken=$TOKEN
263-
notify_result:
264-
name: Check for failures
265-
needs: [perform_release, perform_post_release]
266-
if: failure()
247+
send-notification:
248+
name: Send Notification
249+
needs: [ perform_release, perform_post_release ]
250+
if: ${{ failure() || cancelled() }}
267251
runs-on: ubuntu-latest
268-
permissions:
269-
actions: read
270252
steps:
271-
- name: Send Slack message
272-
# Workaround while waiting for Gamesight/slack-workflow-status#38 to be fixed
273-
# See https://github.com/Gamesight/slack-workflow-status/issues/38
274-
uses: sjohnr/slack-workflow-status@v1-beta
253+
- name: Send Notification
254+
uses: spring-io/spring-security-release-tools/.github/actions/send-notification@v1
275255
with:
276-
repo_token: ${{ secrets.GITHUB_TOKEN }}
277-
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
278-
channel: '#spring-security-ci'
279-
name: 'CI Notifier'
256+
webhook-url: ${{ secrets.SPRING_SECURITY_CI_GCHAT_WEBHOOK_URL }}

.github/workflows/merge-dependabot-pr.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ permissions: write-all
88

99
jobs:
1010
merge-dependabot-pr:
11+
name: Merge Dependabot PR
1112
runs-on: ubuntu-latest
1213
if: ${{ github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'spring-projects/spring-security' }}
1314
steps:
@@ -50,3 +51,13 @@ jobs:
5051
run: gh pr merge ${{ github.event.pull_request.number }} --auto --rebase
5152
env:
5253
GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
54+
send-notification:
55+
name: Send Notification
56+
needs: [ merge-dependabot-pr ]
57+
if: ${{ failure() || cancelled() }}
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Send Notification
61+
uses: spring-io/spring-security-release-tools/.github/actions/send-notification@v1
62+
with:
63+
webhook-url: ${{ secrets.SPRING_SECURITY_CI_GCHAT_WEBHOOK_URL }}

.github/workflows/milestone-spring-releasetrain.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,13 @@ jobs:
2323
export TOOL_VERSION=0.1.1
2424
wget "https://repo.maven.apache.org/maven2/io/spring/releasetrain/spring-release-train-tools/$TOOL_VERSION/spring-release-train-tools-$TOOL_VERSION.jar"
2525
java -cp "spring-release-train-tools-$TOOL_VERSION.jar" io.spring.releasetrain.CheckMilestoneDueOnMain --dueOn "$DUE_ON" --expectedDayOfWeek MONDAY --expectedMondayCount 3
26-
notify_result:
27-
name: Check for failures
28-
needs: [spring-releasetrain-checks]
29-
if: failure()
26+
send-notification:
27+
name: Send Notification
28+
needs: [ spring-releasetrain-checks ]
29+
if: ${{ failure() || cancelled() }}
3030
runs-on: ubuntu-latest
31-
permissions:
32-
actions: read
3331
steps:
34-
- name: Send Slack message
35-
uses: Gamesight/slack-workflow-status@v1.3.0
32+
- name: Send Notification
33+
uses: spring-io/spring-security-release-tools/.github/actions/send-notification@v1
3634
with:
37-
repo_token: ${{ secrets.GITHUB_TOKEN }}
38-
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
39-
channel: '#spring-security-ci'
40-
name: 'CI Notifier'
35+
webhook-url: ${{ secrets.SPRING_SECURITY_CI_GCHAT_WEBHOOK_URL }}

.github/workflows/pr-build-workflow.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,13 @@ jobs:
4242
name: docs
4343
path: docs/build/site
4444
overwrite: true
45+
send-notification:
46+
name: Send Notification
47+
needs: [ build, generate-docs ]
48+
if: ${{ failure() && github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'spring-projects/spring-security' }}
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Send Notification
52+
uses: spring-io/spring-security-release-tools/.github/actions/send-notification@v1
53+
with:
54+
webhook-url: ${{ secrets.SPRING_SECURITY_CI_GCHAT_WEBHOOK_URL }}

.github/workflows/update-scheduled-release-version.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
workflow_dispatch: # Manual trigger only. Triggered by release-scheduler.yml on main.
55

66
env:
7-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
87
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
98

109
permissions:
@@ -58,12 +57,13 @@ jobs:
5857
git tag $updatedVersion
5958
git push
6059
git push origin $updatedVersion
61-
- id: send-slack-notification
62-
name: Send Slack message
63-
if: failure()
64-
uses: Gamesight/[email protected]
60+
send-notification:
61+
name: Send Notification
62+
needs: [ update_scheduled_release_version ]
63+
if: ${{ failure() || cancelled() }}
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Send Notification
67+
uses: spring-io/spring-security-release-tools/.github/actions/send-notification@v1
6568
with:
66-
repo_token: ${{ secrets.GITHUB_TOKEN }}
67-
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
68-
channel: '#spring-security-ci'
69-
name: 'CI Notifier'
69+
webhook-url: ${{ secrets.SPRING_SECURITY_CI_GCHAT_WEBHOOK_URL }}

0 commit comments

Comments
 (0)