chore: Add GitHub actions to notify about PRs #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Slack Notification | |
on: | |
pull_request: | |
types: [opened] | |
jobs: | |
slack-notify: | |
name: Slack Notification | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
show-progress: false | |
- name: Convert PR body to Slack format | |
id: slackify | |
uses: LoveToKnow/[email protected] | |
with: | |
text: ${{ github.event.pull_request.body }} | |
- name: Generate notification payload | |
id: notification | |
env: | |
BODY: ${{ github.event.pull_request.body }} | |
PULL_REQUEST_DATA: ${{ toJson(github.event.pull_request) }} | |
run: | | |
payload=$(node ./.github/utils/slack-notify.mjs '${{ env.PULL_REQUEST_DATA }}' '${{ steps.slackify.outputs.text }}') | |
echo "payload=${payload//$'\n'/'%0A'}" >> $GITHUB_OUTPUT | |
- name: Send PR to Slack | |
id: slack | |
uses: slackapi/[email protected] | |
with: | |
payload: ${{ steps.notification.outputs.payload }} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_CHANGELOG_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |