Skip to content

Commit 7ce931d

Browse files
docs: streamlines doc structure (#590)
1 parent 093434f commit 7ce931d

21 files changed

Lines changed: 347 additions & 449 deletions

docs/_sidebar.json

Lines changed: 14 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,15 @@
11
[
2-
{
3-
"type": "doc",
4-
"id": "tools/slack-github-action/slack-github-action",
5-
"label": "Slack GitHub Action",
6-
"className": "sidebar-title"
7-
},
8-
{ "type": "html", "value": "<hr>" },
9-
"tools/slack-github-action/sending-variables",
10-
{
11-
"type": "category",
12-
"label": "Sending techniques",
13-
"collapsed": false,
14-
"link": {
15-
"type": "doc",
16-
"id": "tools/slack-github-action/sending-techniques/sending-techniques"
17-
},
18-
"items": [
19-
"tools/slack-github-action/sending-techniques/sending-techniques",
20-
{
21-
"type": "category",
22-
"label": "Sending data via a webhook to start a Slack workflow",
23-
"link": {
24-
"type": "doc",
25-
"id": "tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/sending-data-webhook-slack-workflow"
26-
},
27-
"items": [
28-
"tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/sending-data-webhook-slack-workflow",
29-
"tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/format-generated-files",
30-
"tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/post-release-announcements",
31-
"tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow/update-a-channel-topic"
32-
]
33-
},
34-
{
35-
"type": "category",
36-
"label": "Sending data using a Slack API method",
37-
"link": {
38-
"type": "doc",
39-
"id": "tools/slack-github-action/sending-techniques/sending-data-slack-api-method/sending-data-slack-api-method"
40-
},
41-
"items": [
42-
"tools/slack-github-action/sending-techniques/sending-data-slack-api-method/sending-data-slack-api-method",
43-
"tools/slack-github-action/sending-techniques/sending-data-slack-api-method/direct-message-author",
44-
"tools/slack-github-action/sending-techniques/sending-data-slack-api-method/invite-usergroup-to-channel"
45-
]
46-
},
47-
{
48-
"type": "category",
49-
"label": "Sending data as a message with a Slack incoming webhook URL",
50-
"link": {
51-
"type": "doc",
52-
"id": "tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/sending-data-slack-incoming-webhook"
53-
},
54-
"items": [
55-
"tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/sending-data-slack-incoming-webhook",
56-
"tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-inline-text-message",
57-
"tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-inline-block-message",
58-
"tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-blocks-found-in-file"
59-
]
60-
},
61-
{
62-
"type": "category",
63-
"label": "Running Slack CLI commands",
64-
"link": {
65-
"type": "doc",
66-
"id": "tools/slack-github-action/sending-techniques/running-slack-cli-commands/running-slack-cli-commands"
67-
},
68-
"items": [
69-
"tools/slack-github-action/sending-techniques/running-slack-cli-commands/running-slack-cli-commands",
70-
"tools/slack-github-action/sending-techniques/running-slack-cli-commands/deploy-an-app",
71-
"tools/slack-github-action/sending-techniques/running-slack-cli-commands/validate-a-manifest",
72-
"tools/slack-github-action/sending-techniques/running-slack-cli-commands/manage-collaborators"
73-
]
74-
}
75-
]
76-
},
77-
"tools/slack-github-action/additional-configurations"
78-
]
2+
{
3+
"type": "doc",
4+
"id": "tools/slack-github-action/slack-github-action",
5+
"label": "Slack GitHub Action",
6+
"className": "sidebar-title"
7+
},
8+
{ "type": "html", "value": "<hr>" },
9+
"tools/slack-github-action/gathering-variables",
10+
"tools/slack-github-action/sending-data-webhook-slack-workflow",
11+
"tools/slack-github-action/sending-data-slack-api-method",
12+
"tools/slack-github-action/sending-data-slack-incoming-webhook",
13+
"tools/slack-github-action/running-slack-cli-commands",
14+
"tools/slack-github-action/additional-configurations"
15+
]

docs/additional-configurations.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,6 @@ The `errors` option defaults to `false` so failed requests do not cause the step
2121
2222
Invalid inputs to the GitHub Action, such as not including a payload, will always cause the GitHub step to fail.
2323
24-
## Flattening nested payloads
25-
26-
Variables and data provided in the payload might contain nested fields that need to be flattened before being sent with a [webhook trigger](/tools/slack-github-action/sending-techniques/sending-data-webhook-slack-workflow) to match the expected input format of [Workflow Builder](https://slack.com/features/workflow-automation).
27-
28-
The `payload-delimiter` option will flatten the input payload using the provided delimiter and will also make values stringified:
29-
30-
```yaml
31-
- name: Flatten the default GitHub payload
32-
uses: slackapi/slack-github-action@v3.0.1
33-
with:
34-
payload-delimiter: "_"
35-
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
36-
webhook-type: webhook-trigger
37-
```
38-
39-
Reference to the flattening implementation is available for exploration from within the [`flat`](https://www.npmjs.com/package/flat) package.
40-
4124
## Parsing templated variables
4225
4326
Additional variables provided in the GitHub event [context](https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts#L6) and event [payload](https://docs.github.com/en/webhooks/webhook-events-and-payloads) can be used to replace templated variables in the input payload with the `payload-templated` option:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Sending variables
1+
# Gathering variables
22

3-
There are different [techniques to send data](/tools/slack-github-action/sending-techniques) into Slack and whichever one is chosen will require a certain set of customized inputs, as described later.
3+
There are different techniques to send data into Slack and whichever one is chosen will require a certain set of customized inputs, as described later.
44

55
You can provide data to send to Slack from this GitHub Action and either source:
66

docs/sending-techniques/running-slack-cli-commands/running-slack-cli-commands.md renamed to docs/running-slack-cli-commands.md

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
sidebar_label: Overview
3-
---
4-
51
# Running Slack CLI commands
62

73
The Slack CLI technique installs and runs [Slack CLI](/tools/slack-cli/) commands directly from a GitHub Actions workflow.
@@ -82,6 +78,17 @@ steps:
8278
token: ${{ secrets.SLACK_SERVICE_TOKEN }}
8379
```
8480

81+
<details>
82+
<summary><strong>Workflow: Validate a manifest</strong></summary>
83+
84+
This workflow validates the app manifest on pull requests to catch configuration issues early.
85+
86+
```js reference
87+
https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/manifest.yml
88+
```
89+
90+
</details>
91+
8592
### Deploy an app with a service token
8693

8794
```yaml
@@ -93,8 +100,29 @@ steps:
93100
token: ${{ secrets.SLACK_SERVICE_TOKEN }}
94101
```
95102

96-
## Example workflows
103+
<details>
104+
<summary><strong>Workflow: Deploy an app</strong></summary>
105+
106+
This workflow deploys a Slack app when changes are pushed to the main branch. It uses a service token to authenticate the deploy command.
107+
108+
```js reference
109+
https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/deploy.yml
110+
```
111+
112+
</details>
113+
114+
### Manage collaborators
115+
116+
<details>
117+
118+
<summary><strong>Workflow: Manage collaborators</strong></summary>
119+
120+
This workflow adds or removes an app collaborator using a manually triggered workflow.
121+
122+
This example combines the Slack API technique ([`users.lookupByEmail`](https://docs.slack.dev/reference/methods/users.lookupByEmail), [`chat.postMessage`](https://docs.slack.dev/reference/methods/chat.postMessage)) with the CLI technique ([`collaborators add`](https://docs.slack.dev/tools/slack-cli/reference/commands/slack_collaborators_add)/[`remove`](https://docs.slack.dev/tools/slack-cli/reference/commands/slack_collaborators_remove)) to look up a user by email, update collaborators, and post a confirmation message.
123+
124+
```js reference
125+
https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_4_Slack_CLI_Command/collaborators.yml
126+
```
97127

98-
* [**Deploy an app**](/tools/slack-github-action/sending-techniques/running-slack-cli-commands/deploy-an-app): Deploy to Slack on push to the main branch.
99-
* [**Validate a manifest**](/tools/slack-github-action/sending-techniques/running-slack-cli-commands/validate-a-manifest): Check the app manifest on pull requests.
100-
* [**Manage collaborators**](/tools/slack-github-action/sending-techniques/running-slack-cli-commands/manage-collaborators): Add or remove an app collaborator using CLI and API techniques together.
128+
</details>

docs/sending-techniques/sending-data-slack-api-method/sending-data-slack-api-method.md renamed to docs/sending-data-slack-api-method.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
sidebar_label: Overview
3-
---
4-
51
# Sending data using a Slack API method
62

73
A bot token or user token or [token of some other kind](/authentication/tokens) must be used to call one of [the Slack API methods](/reference/methods) with this technique.
@@ -139,7 +135,47 @@ Calling [a Slack API method](/reference/methods) with [`@slack/web-api`](/tools/
139135
filename: "results-${{ github.sha }}.out"
140136
```
141137

138+
## Expected outputs
139+
140+
The technique, like all Slack Github Action techniques, [outputs values](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/passing-information-between-jobs) that can be used as inputs in following steps of a GitHub workflow.
141+
142+
The following outputs are returned with each of the techniques:
143+
144+
| Output | Type | Description|
145+
|---|---|---|
146+
|`time` | `number` | The Unix [epoch time](https://en.wikipedia.org/wiki/Unix_time) that the step completed.
147+
| `ok` | `boolean` | If the request completed with success.
148+
| `response` | `string` | The [response](/apis/web-api/#responses) from the request as stringified JSON.
149+
150+
While these outputs are returned with certain Slack API methods:
151+
152+
| Output | Type | Description|
153+
|---|---|---|
154+
|`channel_id` | `string` | The [channel ID](/reference/objects/conversation-object) included in the response.
155+
| `ts`| `string` | The [timestamp](/messaging/retrieving-messages#individual_messages) of the Slack event or message.
156+
| `thread_ts` | `string` | The [timestamp](/messaging/retrieving-messages#individual_messages) of a parent Slack message with [threaded replies](/messaging/retrieving-messages#pulling_threads).
157+
142158
## Example workflows
143159

144-
- [**Direct message the author**](/tools/slack-github-action/sending-techniques/sending-data-slack-api-method/direct-message-author): Write to the Slack user with a matching email.
145-
- [**Invite a usergroup to channel**](/tools/slack-github-action/sending-techniques/sending-data-slack-api-method/invite-usergroup-to-channel): Create a channel and invite members.
160+
<details>
161+
<summary><strong>Direct message the author</strong></summary>
162+
163+
This workflow sends a direct message to the user that pushed the most recent commits. It does so by grabbing the email of the pusher.
164+
165+
```js reference
166+
https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_2_Slack_API_Method/author.yml
167+
```
168+
169+
</details>
170+
171+
<details>
172+
<summary><strong>Invite a usergroup to channel</strong></summary>
173+
174+
This workflow creates a channel after a bug is reported and add members of a usergroup by chaining multiple Slack API method calls together.
175+
176+
177+
```js reference
178+
https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_2_Slack_API_Method/invite.yml
179+
```
180+
181+
</details>

docs/sending-techniques/sending-data-slack-incoming-webhook/sending-data-slack-incoming-webhook.md renamed to docs/sending-data-slack-incoming-webhook.md

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
sidebar_label: Overview
3-
---
4-
51
# Sending data as a message with a Slack incoming webhook URL
62

73
This technique uses this Action to post a message to a channel or direct message with [incoming webhooks](/messaging/sending-messages-using-incoming-webhooks) and a Slack app.
@@ -44,8 +40,57 @@ Add the collected webhook from above to a GitHub workflow and configure the step
4440
text: "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
4541
```
4642
43+
## Expected outputs
44+
45+
The technique, like all Slack Github Action techniques, [outputs values](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/passing-information-between-jobs) that can be used as inputs in following steps of a GitHub workflow.
46+
47+
The following outputs are returned with each of the techniques:
48+
49+
| Output | Type | Description|
50+
|---|---|---|
51+
|`time` | `number` | The Unix [epoch time](https://en.wikipedia.org/wiki/Unix_time) that the step completed.
52+
| `ok` | `boolean` | If the request completed with success.
53+
| `response` | `string` | The [response](/apis/web-api/#responses) from the request as stringified JSON.
54+
4755
## Example workflows
4856

49-
* [**Post an inline text message**](/tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-inline-text-message)
50-
* [**Post an inline block message**](/tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-inline-block-message)
51-
* [**Post blocks found in a file**](/tools/slack-github-action/sending-techniques/sending-data-slack-incoming-webhook/post-blocks-found-in-file)
57+
<details>
58+
<summary><strong>Post an inline text message</strong></summary>
59+
60+
This workflow uses incoming webhooks to post a plain text message.
61+
62+
```js reference
63+
https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/text.yml
64+
```
65+
66+
</details>
67+
68+
<details>
69+
<summary><strong>Post an inline block message</strong></summary>
70+
71+
This workflow uses incoming webhooks to post a message with Block Kit.
72+
73+
```js reference
74+
https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/blocks.yml
75+
```
76+
77+
</details>
78+
79+
<details>
80+
<summary><strong>Post blocks found in a file</strong></summary>
81+
82+
This workflow uses file data when posting to an incoming webhook. It links to the GitHub Actions job in progress.
83+
84+
Payload file being sent
85+
86+
```js reference
87+
https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/saved.data.json
88+
```
89+
90+
### Workflow
91+
92+
```js reference
93+
https://github.com/slackapi/slack-github-action/blob/main/example-workflows/Technique_3_Slack_Incoming_Webhook/saved.gha.yml
94+
```
95+
96+
</details>

0 commit comments

Comments
 (0)