Skip to content

Workflow file for this run

name: Check Git Log for EMIS Cassettes
on:
push:
schedule:
- cron: '0 * * * *'
jobs:
check-git-log:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Only check current branch unless we're triggered via schedule/cron
id: vars
run: |
if [ "${{ github.event_name }}" = "schedule" ]; then
echo "GIT_LOG_ARGS=--all" >> $GITHUB_ENV
else
echo "GIT_LOG_ARGS=" >> $GITHUB_ENV
fi
- name: Run git log command
run: |
LOG=$(git log $GIT_LOG_ARGS --oneline -- spec/support/vcr_cassettes/emis)
if [ -n "$LOG" ]; then
echo "$LOG" | awk '{print $1}' > bad-shas.txt
echo "EMIs Cassettes found in git history"
echo "Commits and associated branch"
for sha in $(cat bad-shas.txt); do
echo $sha
git branch -r --contains $sha;
done
exit 1
fi
- name: Success Message
run: echo "The git log is empty as expected."
notify_on_failure:
runs-on: ubuntu-latest
if: ${{ failure() }}
needs: [check-git-log]
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: "us-gov-west-1"
- uses: department-of-veterans-affairs/action-inject-ssm-secrets@d8e6de3bde4dd728c9d732baef58b3c854b8c4bb # latest
with:
ssm_parameter: /devops/VA_VSP_BOT_GITHUB_TOKEN
env_variable_name: VA_VSP_BOT_GITHUB_TOKEN
- name: Checkout VSP actions
uses: actions/checkout@v4
with:
repository: department-of-veterans-affairs/vsp-github-actions
ref: refs/heads/main
token: ${{ env.VA_VSP_BOT_GITHUB_TOKEN }}
persist-credentials: false
path: ./.github/actions/vsp-github-actions
- uses: department-of-veterans-affairs/action-inject-ssm-secrets@d8e6de3bde4dd728c9d732baef58b3c854b8c4bb # latest
with:
ssm_parameter: /devops/github_actions_slack_socket_token
env_variable_name: SLACK_APP_TOKEN
- uses: department-of-veterans-affairs/action-inject-ssm-secrets@d8e6de3bde4dd728c9d732baef58b3c854b8c4bb # latest
with:
ssm_parameter: /devops/github_actions_slack_bot_user_token
env_variable_name: SLACK_BOT_TOKEN
- name: slack notify
uses: ./.github/actions/vsp-github-actions/slack-socket
with:
slack_app_token: ${{ env.SLACK_APP_TOKEN }}
slack_bot_token: ${{ env.SLACK_BOT_TOKEN }}
message: "GH Workflow failed: EMIS Cassettes Git History"
blocks: "[{\"type\": \"divider\"}, {\"type\": \"section\", \"text\": { \"type\": \"mrkdwn\", \"text\": \":scared_and_sweating_smiley: GitHub Action Runner Workflow failed! :scared_and_sweating_smiley:\n <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|${{ github.workflow }} Run #${{ github.run_number }}>\"}}, {\"type\": \"divider\"}]"
channel_id: "C039HRTHXDH"