Automated commit: Pin versions of unpinned images #959
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: "8. Notify Slack on branch update" | |
on: | |
push: | |
branches: [ main, qa, develop ] | |
env: | |
# Id for the #benefits-vro-devops Slack channel | |
SLACK_CHANNEL: C04CA47HV96 | |
jobs: | |
notify_push: | |
if: github.repository == 'department-of-veterans-affairs/abd-vro' | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Get PR title" | |
id: get-pr-title | |
run: | | |
echo "first_line=$(echo "${{github.event.head_commit.message}}" | head -n 1)" >> $GITHUB_OUTPUT | |
if [ $(echo "${{github.event.head_commit.message}}" | wc -l) -gt 1 ]; then | |
echo "multiline=true" >> $GITHUB_OUTPUT | |
else | |
echo "multiline=false" >> $GITHUB_OUTPUT | |
fi | |
echo "short_sha=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT | |
- name: "Notify Slack" | |
id: notify-slack | |
uses: archive/[email protected] | |
with: | |
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }} | |
slack-channel: ${{ env.SLACK_CHANNEL }} | |
slack-text: ":git-merge: ${{github.ref_type}} \ | |
<${{github.event.repository.html_url}}/commits/${{github.ref_name}}|${{github.ref_name}}> was pushed \ | |
by `${{github.event.pusher.name}}` using \ | |
<${{github.event.head_commit.url}}|commit ${{steps.get-pr-title.outputs.short_sha}}> \ | |
authored by `${{github.event.head_commit.author.username}}`\n\ | |
`${{ steps.get-pr-title.outputs.first_line }}`" | |
- name: "Slack thread: Post git commit message" | |
if: steps.get-pr-title.outputs.multiline == 'true' | |
# Post in thread to reduce clutter in Slack | |
uses: archive/[email protected] | |
with: | |
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }} | |
slack-channel: ${{ env.SLACK_CHANNEL }} | |
slack-optional-thread_ts: ${{ fromJson(steps.notify-slack.outputs.slack-result).response.message.ts }} | |
slack-text: "*Commit Message*: \n```${{github.event.head_commit.message}}```" |