Skip to content

Commit

Permalink
.github/workflows: address slack API method style breaking changes
Browse files Browse the repository at this point in the history
These workflows were incorrectly updated during the first round of attempted changes, as they are actually the "Slack API Method" technique, not "Slack incoming webhook". The changes include:

- explicitly setting the `method` to `chat.PostMessage`
- passing the token in the `token` argument, rather than the `SLACK_BOT_TOKEN` environment variable
- sending the channel directly in the `payload`, rather than using the `channel-id` argument
  • Loading branch information
jar-b committed Nov 21, 2024
1 parent 0340bd4 commit d8cda59
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/label-notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ jobs:
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
env:
ISSUE_TITLE: ${{ toJSON(github.event.issue.title || github.event.pull_request.title) }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel-id: ${{ secrets.SLACK_CHANNEL }}
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
{
"channel" : "${{ secrets.SLACK_CHANNEL }}",
"blocks": [
{
"type": "section",
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/post_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,12 @@ jobs:
- name: Send Slack Notification Upon Failure
if: ${{ failure() }}
uses: slackapi/slack-github-action@485a9d42d3a73031f12ec201c457e2162c45d02d # v2.0.0
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel-id: ${{ secrets.SLACK_CHANNEL }}
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
{
"channel" : "${{ secrets.SLACK_CHANNEL }}",
"blocks": [
{
"type": "section",
Expand Down

0 comments on commit d8cda59

Please sign in to comment.