From b192839a8e6349cc3e261b1ef673d641b89cad21 Mon Sep 17 00:00:00 2001 From: bryantson <5396174+bryantson@users.noreply.github.com> Date: Wed, 25 May 2022 10:40:48 -0500 Subject: [PATCH] Adding Slack message --- .github/workflows/action-send-slack.yml | 24 ++++++++++++++++++++++++ README.md | 1 + 2 files changed, 25 insertions(+) create mode 100644 .github/workflows/action-send-slack.yml diff --git a/.github/workflows/action-send-slack.yml b/.github/workflows/action-send-slack.yml new file mode 100644 index 0000000..580bc0b --- /dev/null +++ b/.github/workflows/action-send-slack.yml @@ -0,0 +1,24 @@ +name: Send Slack message + +on: + workflow_dispatch: + inputs: + greeting: + description: "Please type in your greeting!" + required: true + default: '' + +jobs: + Hello-GitHub-Actions: + runs-on: ubuntu-latest + name: Post to a Slack channel + + steps: + - name: Hello, GitHub Actions + id: slack + uses: slackapi/slack-github-action@v1.14.0 + with: + channel-id: 'YOUR_SLACK_CHANNEL_ID' + slack-message: 'Posting from GitHub Actions! Here is my greeting: ${{ github.event.inputs.greeting }}' + env: + SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 81c6a2c..4c613ba 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Sample GitHub Actions workflows included in this repo | [`.github/workflows/action-multiple-self-hosted-runners.yml`](/.github/workflows/action-multiple-self-hosted-runners.yml) | Example of using multiple runners including self-hosted runners | | [`.github/workflows/action-issueops.yml`](/.github/workflows/action-issueops.yml) | Example of IssueOps workflow | | [`.github/workflows/action-migrate-containers.yml`](/.github/workflows/action-migrate-containers.yml) | Example of migrating containers from DockerHub to GitHub Container registry | +| [`.github/workflows/action-send-slack.yml`](/.github/workflows/action-send-slack.yml) | Example of sending a Slack message from Actions | Sample GitHub Package registry codes included in this repo