Skip to content
This repository was archived by the owner on Jan 3, 2023. It is now read-only.

Latest commit

 

History

History
26 lines (18 loc) · 2.56 KB

workshop_overview.md

File metadata and controls

26 lines (18 loc) · 2.56 KB

Making GitHub Actions actionable workshop overview

In this workshop, we’ll use GitHub Actions to allow you to notify team members in Slack when a GitHub issue requires their attention.

First, we’ll create a new Action that will parse your issues and comments for a special "/cc Slack" string. Then, we’ll combine the Action we created with an existing Action from the GitHub Marketplace that posts messages to Slack. Finally, we’ll verify that our workflow works as intended by creating some test issues and comments.

Create your Action

  1. Create a new public repository for your GitHub Action.
  2. Create a Dockerfile at the root of the repository. Give it access to JavaScript using the node:slim as the base image. Set the ENTRYPOINT to /index.js.
  3. Create a package.json at the root of the repository. Include the dependencies your Action will use.
  4. Create a index.js at the root of the repository. require the actions-toolkit library to get access to some great helpers for writing an Action in JavaScript. Specify which events you want the Action to respond to, and implement the logic to identify "/cc Slack" in issue bodies and comments and persist message data to the shared workspace.

Create your workflow

  1. Create a new Slack App.
  2. Find or create a new repository from which you’d like to CC team members in Slack.
  3. Click the "Actions" tab and then the "Create a new workflow" button to create a new .github/main.workflow file.
  4. Create a new workflow triggered by the issues event. Add the Action you created above as the first Action in the new workflow. Add the slack-bot-action as the second action. Using the information from your Slack App, create CONVERSATION_ID and SLACK_BOT_TOKEN secrets and expose them to the slack-bot-action.
  5. Create another workflow triggered by the issue_comment event and repeat the previous step.

Test your workflow

  1. Create a new issue with "/cc Slack" in the body. Click the Actions tab to monitor your workflow and view Action logs. Verify that you receive a message in Slack referencing the new issue.
  2. Comment on the issue with "/cc Slack" in the body. Verify that you receive a message in Slack referencing the new issue.
  3. Comment on the issue without "/cc Slack" in the body. Verify that you don’t receive any new messages in Slack.