Skip to content

Commit

Permalink
Fix/slack webhook calls not passing data (#2039)
Browse files Browse the repository at this point in the history
* fix(workflows/slack webhook): encode JSON properly

* fix: update workflows so that the variables are replaced properly
  • Loading branch information
andrewleith authored Jan 9, 2025
1 parent 23a155b commit 79ac85c
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cypress-staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ jobs:
- name: Notify Slack channel if this job failed
if: ${{ failure() }}
run: |
json='{"text":"<!here> Staging a11y tests failed: <https://github.com/cds-snc/notification-admin/actions/runs/${GITHUB_RUN_ID}|see failure details> !"}'
json='{"text": "<!here> Staging a11y tests failed: <https://github.com/cds-snc/notification-admin/actions/runs/'${GITHUB_RUN_ID}'|see failure details> !"}'
curl -X POST -H 'Content-type: application/json' --data "$json" ${{ secrets.SLACK_WEBHOOK }}
2 changes: 1 addition & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,5 @@ jobs:
- name: Notify Slack channel if this job failed
if: ${{ failure() }}
run: |
json="{'text':'<!here> CI is failing in <https://github.com/cds-snc/notification-admin/actions/runs/${GITHUB_RUN_ID}|see failure details> !'}"
json='{"text":"<!here> CI is failing in <https://github.com/cds-snc/notification-admin/actions/runs/'${GITHUB_RUN_ID}'|see failure details> !"}'
curl -X POST -H 'Content-type: application/json' --data "$json" ${{ secrets.SLACK_WEBHOOK }}
2 changes: 1 addition & 1 deletion .github/workflows/s3-backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ jobs:
- name: Notify Slack channel if this job failed
if: ${{ failure() }}
run: |
json='{"text":"S3 backup failed in <https://github.com/${{ github.repository }}>!"}'
json='{"text":"S3 backup failed in <https://github.com/'${{ github.repository }}'>!"}'
curl -X POST -H 'Content-type: application/json' --data "$json" ${{ secrets.SLACK_NOTIFY_WEBHOOK }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ jobs:
- name: Notify Slack channel if this job failed in default branch
if: ${{ failure() && github.ref == 'refs/heads/main' }}
run: |
json="{'text':'<!here> CI is failing in <https://github.com/cds-snc/notification-admin/|notification-admin> !'}"
json='{"text":"<!here> CI is failing in <https://github.com/cds-snc/notification-admin/|notification-admin> !"}'
curl -X POST -H 'Content-type: application/json' --data "$json" ${{ secrets.SLACK_WEBHOOK }}
2 changes: 1 addition & 1 deletion .github/workflows/test_prod_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ jobs:
- name: Notify Slack channel if this job failed in default branch
if: ${{ failure() && github.ref == 'refs/heads/main' }}
run: |
json="{'text':'<!here> CI is failing in <https://github.com/cds-snc/notification-admin/|notification-admin> !'}"
json='{"text":"<!here> CI is failing in <https://github.com/cds-snc/notification-admin/|notification-admin> !"}'
curl -X POST -H 'Content-type: application/json' --data "$json" ${{ secrets.SLACK_WEBHOOK }}

0 comments on commit 79ac85c

Please sign in to comment.