Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention author in summary message #55

Merged
merged 8 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"semi": "off",
"@typescript-eslint/semi": ["error", "never"],
"@typescript-eslint/type-annotation-spacing": "error",
"filenames/match-regex": ["error", "^[a-z0-9-]+(.d|.config|.test)?$"]
"filenames/match-regex": "off"
},
"env": {
"node": true,
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ jobs:
run: npm ci

- name: Rebuild the dist/ directory
run: |
npm run build
npm run package
run: npm run build

- name: Compare the expected and actual dist/ directories
run: |
Expand Down
8 changes: 7 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"cSpell.words": ["endregion", "Fieldguide", "mrkdwn", "namoscato"],
"cSpell.words": [
"endregion",
"Fieldguide",
"mrkdwn",
"namoscato",
"USLACKBOT"
],
"files.exclude": {
"dist": true,
"lib": true
Expand Down
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@ Post [GitHub Action](https://github.com/features/actions) deploy workflow progre

<br />

<img width="482" alt="Slack Deploy Pipeline Notifications example thread" src="https://user-images.githubusercontent.com/847532/196043237-bf16fcf7-ff45-443b-a3b2-ec3d51f17ee5.jpg">
<img width="524" alt="Slack Deploy Pipeline Notifications example thread" src="https://user-images.githubusercontent.com/847532/230737887-1d18a062-af7f-4c7f-a78c-e604fc9803c2.jpg">

## Features

- Posts summary message at beginning of the deploy workflow, surfacing commit message and author
- Maps GitHub commit author to Slack user by full name, mentioning them in the summary message
- Threads intermediate stage completions, sending unexpected failures back to the channel
- Updates summary message duration at conclusion of the workflow
- Supports `pull_request`, `push`, and `schedule` [event types](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows)
- Supports `pull_request`, `push`, `schedule`, and `workflow_dispatch` [event types](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows)

## Setup

1. [Create a Slack App](https://api.slack.com/apps) for your workspace
1. Under **OAuth & Permissions**, add two Bot Token Scopes:
1. [`chat:write`](https://api.slack.com/scopes/chat:write) to post messages
1. [`chat:write.customize`](https://api.slack.com/scopes/chat:write.customize) to customize messages with GitHub username and avatar
1. [`chat:write.customize`](https://api.slack.com/scopes/chat:write.customize) to customize messages with GitHub commit author
1. [`users:read`](https://api.slack.com/scopes/users:read) to map GitHub user to Slack user
1. Install the app to your workspace
1. Copy the app's **Bot User OAuth Token** from the **OAuth & Permissions** page
1. [Create a GitHub repository secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) with this token, named `SLACK_DEPLOY_BOT_TOKEN`
1. [Create a GitHub secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets) with this token, named `SLACK_DEPLOY_BOT_TOKEN`
1. Invite the bot user into the Slack channel you will post messages to (`/invite @bot_user_name`)
1. Click the Slack channel name in the header, and copy its **Channel ID** from the bottom of the dialog

Expand Down
Loading