Skip to content

Commit 47ecafe

Browse files
committed
docs: include an example workflow that uses outputs as inputs
1 parent d4e83d6 commit 47ecafe

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,32 @@ While these outputs are returned with certain Slack API methods:
455455
- `ts`: `string`. The timestamp of the Slack event.
456456
- `thread_ts`: `string`. The timestamp of a Slack message.
457457

458+
### Example responses
459+
460+
The following snippet shows how multiple steps can be chained together to create
461+
a Slack channel before posting a message:
462+
463+
```yaml
464+
- name: Create a new Slack channel for recent changes
465+
id: conversation
466+
uses: ./
467+
with:
468+
method: conversations.create
469+
token: ${{ secrets.SLACK_BOT_TOKEN }}
470+
payload: |
471+
name: pull-request-review-${{ github.sha }}
472+
473+
- name: Send the pull request link into the Slack channel
474+
if: ${{ steps.conversation.outputs.ok }}
475+
uses: ./
476+
with:
477+
method: chat.postMessage
478+
token: ${{ secrets.SLACK_BOT_TOKEN }}
479+
payload: |
480+
channel: ${{ steps.conversation.outputs.channel_id }}
481+
text: "A PR was created <!date^${{ steps.conversation.outputs.time }}^{date_num} {time_secs}|just now>: ${{ github.event.pull_request.html_url }}"
482+
```
483+
458484
## License
459485

460486
This project is licensed under the [MIT license](LICENSE).

0 commit comments

Comments
 (0)