Skip to content

Daily Check for GCP secret expiration #113

Daily Check for GCP secret expiration

Daily Check for GCP secret expiration #113

name: Daily Check for GCP secret expiration
on:
workflow_dispatch:
schedule: # At 04:00 every morning UTC
- cron: '0 04 * * *'
jobs:
secret-expire-check:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Run check if any secrets will expire within next month
id: secret-expire-check-month
run: |
set +e
set -o pipefail
OUTPUT=$(./bin/check_secret_expire.sh $(date -d "+1 month" +"%Y-%m-%d"))
RESULT=$?
echo "$OUTPUT"
{
echo "check_output<<EOF"
echo "$OUTPUT"
echo "EOF"
} >> $GITHUB_OUTPUT
exit $RESULT
- name: Slack Notification on Failure
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_CHANNEL: secret-expire
SLACK_WEBHOOK: ${{ secrets.MERKELY_SLACK_CI_FAILURES_WEBHOOK }}
SLACK_USERNAME: GithubActions
SLACK_COLOR: ${{ job.status }}
SLACKIFY_MARKDOWN: true
SLACK_TITLE: GCP secret has expired or is about to
SLACK_MESSAGE: |
Some GCP secrets in `cloud-run-example` are about to or have expired.
${{ steps.secret-expire-check-month.outputs.check_output }}
SLACK_FOOTER: |
Please check the [log](${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }})
for more details.