From 47ecafe38605c29fbb198fb09f6ac47578c8cda1 Mon Sep 17 00:00:00 2001 From: "@zimeg" Date: Thu, 31 Oct 2024 19:16:54 -0700 Subject: [PATCH] docs: include an example workflow that uses outputs as inputs --- README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.md b/README.md index d4e628d..a51ac89 100644 --- a/README.md +++ b/README.md @@ -455,6 +455,32 @@ While these outputs are returned with certain Slack API methods: - `ts`: `string`. The timestamp of the Slack event. - `thread_ts`: `string`. The timestamp of a Slack message. +### Example responses + +The following snippet shows how multiple steps can be chained together to create +a Slack channel before posting a message: + +```yaml +- name: Create a new Slack channel for recent changes + id: conversation + uses: ./ + with: + method: conversations.create + token: ${{ secrets.SLACK_BOT_TOKEN }} + payload: | + name: pull-request-review-${{ github.sha }} + +- name: Send the pull request link into the Slack channel + if: ${{ steps.conversation.outputs.ok }} + uses: ./ + with: + method: chat.postMessage + token: ${{ secrets.SLACK_BOT_TOKEN }} + payload: | + channel: ${{ steps.conversation.outputs.channel_id }} + text: "A PR was created : ${{ github.event.pull_request.html_url }}" +``` + ## License This project is licensed under the [MIT license](LICENSE).