Workflow CI/CD Steps: cargo audit #34
This file contains hidden or 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: Audit | |
| run-name: "Workflow CI/CD Steps: cargo audit" | |
| on: | |
| schedule: | |
| - cron: "0 1 * * SAT" # Runs every Saturday 1:00 UTC | |
| workflow_call: | |
| workflow_dispatch: | |
| jobs: | |
| audit: | |
| runs-on: warp-ubuntu-latest-x64-2x | |
| name: Cargo audit | |
| steps: | |
| - name: Git checkout | |
| uses: actions/checkout@v4 | |
| - name: Cargo audit | |
| uses: ./.github/actions/cmd-in-docker | |
| with: | |
| command: "cargo audit 2>&1 | tee audit_output.txt" | |
| use_cache: 'no' | |
| cargo_binaries_install: cargo-audit | |
| - name: Upload cargo audit output | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: audit-output | |
| path: audit_output.txt | |
| retention-days: 7 | |
| compression-level: 0 | |
| overwrite: true | |
| # Slack notification if failed on scheduled run | |
| failure-notification: | |
| runs-on: warp-ubuntu-latest-x64-2x | |
| name: Notify if failed | |
| needs: [audit] | |
| if: ${{ failure() && !cancelled() && github.event_name == 'schedule' }} | |
| steps: | |
| - name: Send Slack notification | |
| uses: slackapi/slack-github-action@v1.25.0 | |
| with: | |
| payload: | | |
| { | |
| "blocks": [ | |
| { | |
| "type": "header", | |
| "text": { | |
| "type": "plain_text", | |
| "text": "🚨 ALERT - ${{ github.workflow }} Job Failed! 🚨" | |
| } | |
| }, | |
| { | |
| "type": "section", | |
| "fields": [ | |
| { | |
| "type": "mrkdwn", | |
| "text": "*Job URL:* <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Job>" | |
| } | |
| ] | |
| } | |
| ] | |
| } | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.QA_SLACK_WEBHOOK_URL }} | |
| SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |