Skip to content

Commit 14e32cd

Browse files
authored
chore: add ci-notify-slack.yml (#46)
This PR adds `ci-notify-slack.yml` to send out slack notifications about PRs. The content is copied from [dfinity/stable-structures](https://github.com/dfinity/stable-structures/blob/c567ed2eb6f1754e676ce5ae2124b65b769d3498/.github/workflows/ci-notify-slack.yml).
1 parent 1f76aa7 commit 14e32cd

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: PR Slack Notification
2+
3+
on:
4+
pull_request:
5+
types: [opened, ready_for_review]
6+
7+
jobs:
8+
notify-slack:
9+
name: Notify Slack
10+
if: github.event.pull_request.draft == false
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Sanitize PR title
17+
id: sanitize
18+
env:
19+
RAW_TITLE: ${{ github.event.pull_request.title }}
20+
run: |
21+
ESCAPED_TITLE=$(echo "$RAW_TITLE" \
22+
| sed 's/&/\&/g' \
23+
| sed 's/</\&lt;/g' \
24+
| sed 's/>/\&gt;/g')
25+
echo "safe_title=$ESCAPED_TITLE" >> "$GITHUB_OUTPUT"
26+
27+
- name: Post to a Slack channel
28+
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
29+
with:
30+
method: chat.postMessage
31+
token: ${{ secrets.SLACK_API_TOKEN }}
32+
payload: |
33+
channel: eng-execution-mrs
34+
text: ":github: `${{ github.repository }}` <${{ github.event.pull_request.html_url }}|${{ steps.sanitize.outputs.safe_title }}>"

0 commit comments

Comments
 (0)