add changes to the diff #11
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] | |
jobs: | |
slack: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get the most recent release tag | |
run: | | |
echo "fetching tags" | |
git describe --tags --abbrev=0 | |
echo "latest_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
- name: Generate git diff | |
run: | | |
git diff ${{env.latest_tag}} HEAD src/igvfd/schemas/changelogs/* > diff.txt | |
- name: Prepare the Slack message | |
run: | | |
DIFF_CONTENT=$(head -n 100 diff.txt | sed 's/"/\\"/g') | |
echo "slack_blocks=[{\"type\": \"section\", \"text\": {\"type\": \"mrkdwn\", \"text\": \"Changes from ${{ env.latest_tag }} to HEAD:\n\`\`\`$DIFF_CONTENT\`\`\`\"}}]" >> $GITHUB_ENV | |
- 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: | | |
channel: ${{secrets.TEST_CHANNEL_ID}} | |
blocks: ${{env.slack_blocks}} |