add the script #13
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
on: [push] | |
# 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.TEST_CHANNEL_ID}} | |
- name: Post a message to Slack | |
uses: slackapi/slack-github-action@v2.0.0 | |
with: | |
method: chat.postMessage | |
token: ${{secrets.SUBMITTER_HELPDESK_SLACK_BOT_TOKEN}} | |
payload-file-path: slack_payload.json |