Description
I’m trying to integrate buttons in Slack with GitHub Actions, so when I press a specific button, it runs a certain action. In the Slack documentation, it says there’s a url option where a request will be sent when the button is pressed. However, it requires running your own server to handle these requests. Is there any way to avoid running a server and still run the action I need? Here’s the payload I send:
- name: Send Slack notification for production approval
uses: slackapi/slack-github-action@v2.0.0
with:
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.SLACK_CHANNEL_ID }}
text: "New release request"
blocks:
- type: "header"
text:
type: "plain_text"
text: "New release request"
- type: "divider"
- type: "section"
fields:
- type: "mrkdwn"
text: "*Commit ID:*\n${{ github.event.pull_request.head.sha }}"
- type: "mrkdwn"
text: "*When:*\n${{ github.event.pull_request.merged_at }}"
- type: "mrkdwn"
text: "*Created by:*\n<${{ github.event.pull_request.user.html_url }}|@${{ github.event.pull_request.user.login }}>"
- type: "mrkdwn"
text: "*Merged by:*\n<${{ github.event.pull_request.merged_by.html_url }}|@${{ github.event.pull_request.merged_by.login }}>"
- type: "divider"
- type: "actions"
elements:
- type: "button"
text:
type: "plain_text"
text: "Approve"
action_id: "approve_production_deploy"
value: "${{ github.event.pull_request.head.sha }}"
url: // Here we need a forward url
style: "primary"
confirm:
title:
type: "plain_text"
text: "Are you sure?"
text:
type: "plain_text"
text: "Release the version to production? Action cannot be undone unless reverted manually"
confirm:
type: "plain_text"
text: "Release"
deny:
type: "plain_text"
text: "Close"
- type: "button"
text:
type: "plain_text"
text: "Reject"
action_id: "reject_production_deploy"
value: "${{ github.event.pull_request.head.sha }}"
url: // Here we need a forward url
style: "danger"
confirm:
title:
type: "plain_text"
text: "Are you sure?"
text:
type: "plain_text"
text: "By rejecting this release preview is going to be returned to the latest release"
style: "danger"
confirm:
type: "plain_text"
text: "Reject"
deny:
type: "plain_text"
text: "Close"
What type of issue is this? (place an x in one of the [ ])
Requirements (place an x in each of the [ ])
Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
package version:
node version:
OS version(s):
Steps to reproduce:
Expected result:
What you expected to happen
Actual result:
What actually happened
Attachments:
Logs, screenshots, screencast, sample project, funny gif, etc.
Description
I’m trying to integrate buttons in Slack with GitHub Actions, so when I press a specific button, it runs a certain action. In the Slack documentation, it says there’s a
urloption where a request will be sent when the button is pressed. However, it requires running your own server to handle these requests. Is there any way to avoid running a server and still run the action I need? Here’s the payload I send:What type of issue is this? (place an
xin one of the[ ])Requirements (place an
xin each of the[ ])Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
package version:
node version:
OS version(s):
Steps to reproduce:
Expected result:
What you expected to happen
Actual result:
What actually happened
Attachments:
Logs, screenshots, screencast, sample project, funny gif, etc.