Skip to content

Commit b83a97a

Browse files
Merge branch 'master' into dependabot/npm_and_yarn/master/react-dom-19.2.4
2 parents ad2db10 + 549a74a commit b83a97a

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/release.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ on:
2020
description: 'Use the GitHub-hosted large runner. Allowed values are true or false. Caution - this results in additional charges to the organization.'
2121
required: false
2222
default: 'false'
23+
securityAdvisoryPublished:
24+
description: 'Indicates if a security advisory has been published. Provide the title of the security advisory if true, otherwise leave empty. Example: Security Advisory 007- MongoDB zlib Compression Memory'
25+
required: false
26+
default: ''
2327

2428
env:
2529
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -171,6 +175,51 @@ jobs:
171175
SLACKIFY_MARKDOWN: true
172176
ENABLE_ESCAPES: true
173177
SLACK_MESSAGE: "The large runner release job for `${{ github.workflow }}` in `${{ github.repository }}` failed at step: `${{ env.CURRENT_STEP }}`. [View details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})."
178+
179+
post-security-advisory:
180+
name: "Post Security Advisory Notification"
181+
if: always() && (needs.build-large-runner.result == 'success' || needs.build-self-hosted-runner.result == 'success') && github.event_name == 'workflow_dispatch' && github.event.inputs.securityAdvisoryPublished != ''
182+
needs: [build-self-hosted-runner,build-large-runner]
183+
runs-on: ubuntu-latest
184+
steps:
185+
- name: Slugify Security Advisory Title
186+
id: slugify
187+
run: |
188+
echo "CURRENT_STEP=Security Advisory URL" >> $GITHUB_ENV
189+
SECURITY_ADVISORY_PUBLISHED="${{ github.event.inputs.securityAdvisoryPublished }}"
190+
# Create a slug by converting to lowercase, removing periods and colons, and replacing spaces and special characters with hyphens
191+
SLUG=$(echo "$SECURITY_ADVISORY_PUBLISHED" \
192+
| tr '[:upper:]' '[:lower:]' \
193+
| sed 's/\.//g' \
194+
| sed 's/\://g' \
195+
| sed 's/[^a-z0-9-]/-/g')
196+
SECURITY_ADVISORY_URL="https://docs.spectrocloud.com/security-bulletins/security-advisories/#${SLUG}"
197+
echo "Security Advisory URL: ${SECURITY_ADVISORY_URL}"
198+
# Export the URL as a step output so later steps can read it
199+
echo "security_advisory_url=${SECURITY_ADVISORY_URL}" >> "$GITHUB_OUTPUT"
200+
201+
- name: Notify Slack
202+
uses: rtCamp/[email protected]
203+
env:
204+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
205+
SLACK_USERNAME: "spectromate"
206+
SLACK_ICON_EMOJI: ":robot_panic:"
207+
SLACK_COLOR: "#1E90FF"
208+
SLACK_MESSAGE: |
209+
:information_source: *<${{ steps.slugify.outputs.security_advisory_url }}|${{ github.event.inputs.securityAdvisoryPublished }}>* has just been published!
210+
211+
- name: Slack Notification on Failure
212+
if: ${{ failure() }}
213+
uses: rtCamp/[email protected]
214+
env:
215+
SLACK_WEBHOOK: ${{ secrets.SLACK_PRIVATE_TEAM_WEBHOOK }}
216+
SLACK_USERNAME: "spectromate"
217+
SLACK_ICON_EMOJI: ":robot_panic:"
218+
SLACK_COLOR: "danger"
219+
SLACKIFY_MARKDOWN: true
220+
ENABLE_ESCAPES: true
221+
SLACK_MESSAGE: "The post-security-advisory job for `${{ github.workflow }}` in `${{ github.repository }}` failed at step: `${{ env.CURRENT_STEP }}`. [View details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})."
222+
174223

175224
release:
176225
name: "Release"

0 commit comments

Comments
 (0)