-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: complete example manifest and workflows after testing
- Loading branch information
Showing
16 changed files
with
371 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,7 +164,7 @@ achieved by adding this step to a job in your GitHub workflow and inviting the | |
bot associated with your app to the channel for posting: | ||
|
||
```yaml | ||
- name: Post to a Slack channel | ||
- name: Post text to a Slack channel | ||
uses: slackapi/[email protected] | ||
with: | ||
method: chat.postMessage | ||
|
@@ -180,7 +180,7 @@ More complex message layouts, such as messages made with [Block Kit][block-kit] | |
blocks, can also be sent with one of the Slack API methods: | ||
|
||
```yaml | ||
- name: Post to a Slack channel | ||
- name: Post blocks to a Slack channel | ||
uses: slackapi/[email protected] | ||
with: | ||
method: chat.postMessage | ||
|
@@ -203,7 +203,7 @@ outputs from past steps as inputs to current ones: | |
|
||
```yaml | ||
- name: Initiate the deployment launch sequence | ||
id: slack | ||
id: launch_sequence | ||
uses: slackapi/[email protected] | ||
with: | ||
method: chat.postMessage | ||
|
@@ -226,7 +226,7 @@ outputs from past steps as inputs to current ones: | |
token: ${{ secrets.SLACK_BOT_TOKEN }} | ||
payload: | | ||
channel: ${{ secrets.SLACK_CHANNEL_ID }} | ||
ts: "${{ steps.slack.outputs.ts }}" | ||
ts: "${{ steps.launch_sequence.outputs.ts }}" | ||
text: "Deployment finished! :rocket:" | ||
attachments: | ||
- color: "28a745" | ||
|
@@ -307,6 +307,12 @@ Gather a Slack incoming webhook URL: | |
6. [Add this Action as a step][job-step] to your GitHub workflow and provide an | ||
input payload to send as a message. | ||
|
||
The webhook URL will resemble something like so: | ||
|
||
```txt | ||
https://hooks.slack.com/services/T0123456789/B1001010101/7IsoQTrixdUtE971O1xQTm4T | ||
``` | ||
|
||
#### Usage | ||
|
||
Add the collected webhook from above to a GitHub workflow and configure the step | ||
|
@@ -342,7 +348,7 @@ The `errors` option defaults to `false` so failed requests do not cause the step | |
to fail. This result can still be gathered from the `ok` output. | ||
|
||
```yaml | ||
- name: Send GitHub Action data to a Slack workflow | ||
- name: Attempt to call an unknown method | ||
uses: slackapi/[email protected] | ||
with: | ||
errors: true | ||
|
@@ -366,7 +372,7 @@ The `payload-delimiter` option will flatten the input payload using the provided | |
delimiter and will also make values stringified: | ||
|
||
```yaml | ||
- name: Send GitHub Action data to a Slack workflow | ||
- name: Flatten the default GitHub payload | ||
uses: slackapi/[email protected] | ||
with: | ||
payload-delimiter: "_" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
114 changes: 113 additions & 1 deletion
114
example-workflows/Technique_1_Slack_Workflow_Builder/announcements.manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,113 @@ | ||
{} | ||
{ | ||
"_metadata": { | ||
"major_version": 2 | ||
}, | ||
"display_information": { | ||
"name": "Slack GitHub Actions Releaser", | ||
"description": "Sharing the latest news in channel" | ||
}, | ||
"features": { | ||
"app_home": { | ||
"messages_tab_enabled": false | ||
}, | ||
"bot_user": { | ||
"display_name": "Slack GitHub Actions Releaser" | ||
} | ||
}, | ||
"oauth_config": { | ||
"scopes": { | ||
"bot": ["chat:write", "chat:write.public", "reactions:write"] | ||
} | ||
}, | ||
"settings": { | ||
"org_deploy_enabled": true | ||
}, | ||
"workflows": { | ||
"release_announcement": { | ||
"title": "Release announcement", | ||
"description": "Share excitement around the latest changes", | ||
"input_parameters": { | ||
"properties": { | ||
"draft_channel": { | ||
"type": "slack#/types/channel_id" | ||
}, | ||
"release_notes": { | ||
"type": "string" | ||
}, | ||
"release_repository": { | ||
"type": "string" | ||
}, | ||
"release_version": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": [ | ||
"draft_channel", | ||
"release_notes", | ||
"release_repository", | ||
"release_version" | ||
] | ||
}, | ||
"steps": [ | ||
{ | ||
"id": "0", | ||
"function_id": "slack#/functions/send_message", | ||
"inputs": { | ||
"channel_id": "{{inputs.draft_channel}}", | ||
"message": "A new release of <https://github.com/{{inputs.release_repository}}/releases/tag/{{inputs.release_version}}|{{inputs.release_repository}}@{{inputs.release_version}}> was tagged! :rocket:", | ||
"interactive_blocks": [ | ||
{ | ||
"type": "actions", | ||
"elements": [ | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "Share" | ||
}, | ||
"action_id": "share" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"id": "1", | ||
"function_id": "slack#/functions/open_form", | ||
"inputs": { | ||
"title": "Share the release notes", | ||
"interactivity": "{{steps.0.interactivity}}", | ||
"submit_label": "Share", | ||
"fields": { | ||
"elements": [ | ||
{ | ||
"name": "announcement_channel", | ||
"title": "Select an announcements channel", | ||
"type": "slack#/types/channel_id" | ||
} | ||
], | ||
"required": ["announcement_channel"] | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "2", | ||
"function_id": "slack#/functions/send_message", | ||
"inputs": { | ||
"channel_id": "{{steps.1.fields.announcement_channel}}", | ||
"message": "A new release of <https://github.com/{{inputs.release_repository}}/releases/tag/{{inputs.release_version}}|{{inputs.release_repository}}@{{inputs.release_version}}> was tagged! :rocket:\n```{{inputs.release_notes}}```" | ||
} | ||
}, | ||
{ | ||
"id": "3", | ||
"function_id": "slack#/functions/add_reaction", | ||
"inputs": { | ||
"message_context": "{{steps.2.message_context}}", | ||
"emoji": "tada" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
example-workflows/Technique_1_Slack_Workflow_Builder/announcements.trigger.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"type": "webhook", | ||
"name": "Release webhook", | ||
"description": "Share the most recent changes", | ||
"workflow": "#/workflows/release_announcement", | ||
"inputs": { | ||
"draft_channel": { | ||
"value": "{{data.draft_channel}}" | ||
}, | ||
"release_notes": { | ||
"value": "{{data.release_notes}}" | ||
}, | ||
"release_repository": { | ||
"value": "{{data.release_repository}}" | ||
}, | ||
"release_version": { | ||
"value": "{{data.release_version}}" | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
example-workflows/Technique_1_Slack_Workflow_Builder/builds.data.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"status": "done", | ||
"task": "Downstream staging rollout", | ||
"errors": "", | ||
"runner": "github-actions" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
name: Format generated files | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
run: | ||
name: Write structured data as a message | ||
|
@@ -16,7 +18,6 @@ jobs: | |
- name: Start the Slack workflow | ||
uses: slackapi/[email protected] | ||
with: | ||
payload-file-path: "./example-workflows/Technique_1_Slack_Workflow_Builder/format.data.json" | ||
payload-templated: true | ||
payload-file-path: "./example-workflows/Technique_1_Slack_Workflow_Builder/builds.data.json" | ||
webhook: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
webhook-type: webhook-trigger |
Oops, something went wrong.