|
20 | 20 | description: 'Use the GitHub-hosted large runner. Allowed values are true or false. Caution - this results in additional charges to the organization.' |
21 | 21 | required: false |
22 | 22 | 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: '' |
23 | 27 |
|
24 | 28 | env: |
25 | 29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
@@ -171,6 +175,51 @@ jobs: |
171 | 175 | SLACKIFY_MARKDOWN: true |
172 | 176 | ENABLE_ESCAPES: true |
173 | 177 | 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 | + |
| 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 | + |
| 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 | + |
174 | 223 |
|
175 | 224 | release: |
176 | 225 | name: "Release" |
|
0 commit comments