-
Notifications
You must be signed in to change notification settings - Fork 2
34 lines (33 loc) · 1.3 KB
/
github-actions-slack.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
on:
release:
types: [published]
jobs:
slack:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get the two most recent tags
run: |
TAGS=$(git tag --sort=-creatordate | head -n 2)
if [ "$(echo "$TAGS" | wc -l)" -lt 2 ]; then
echo "Insufficient tags to calculate diff."
exit 1
fi
TAG_OLD=$(echo "$TAGS" | tail -n 1)
TAG_NEW=$(echo "$TAGS" | head -n 1)
echo "tag_old=$TAG_OLD" >> $GITHUB_ENV
echo "tag_new=$TAG_NEW" >> $GITHUB_ENV
- name: Generate git diff
run: |
git diff --unified=0 ${{env.tag_old}} ${{env.tag_new}} src/igvfd/schemas/changelogs/* | grep -v ^--- | grep -E "^[\+|#| #|-]"> diff.txt
- name: Prepare the Slack message
run: |
python scripts/slack/generate_payload.py --diff-file diff.txt --output-file slack_payload.json --tag-old ${{env.tag_old}} --tag-new ${{env.tag_new}} --channel-id ${{secrets.SUBMITTER_HELPDESK_CHANNEL_ID}}
- name: Post a message to Slack
uses: slackapi/[email protected]
with:
method: chat.postMessage
token: ${{secrets.SUBMITTER_HELPDESK_SLACK_BOT_TOKEN}}
payload-file-path: slack_payload.json