Update GH actions #9
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: Performance Audit (Slack on Failure Only) | |
| # This workflow only sends Slack notifications when the audit FAILS | |
| # Use this to reduce notification noise | |
| on: | |
| push: | |
| branches: [ main, development ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| performance-audit: | |
| name: Run Performance Audit | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install jq | |
| run: sudo apt-get update && sudo apt-get install -y jq | |
| - name: Run performance audit | |
| id: audit | |
| run: | | |
| ./dist/bin/check-performance.sh \ | |
| --paths "." \ | |
| --format json \ | |
| --strict \ | |
| > audit-results.json | |
| EXIT_CODE=$? | |
| echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT | |
| exit $EXIT_CODE | |
| continue-on-error: true | |
| - name: Post failure to Slack | |
| if: failure() || steps.audit.outputs.exit_code != '0' | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| run: | | |
| if [ -n "$SLACK_WEBHOOK_URL" ]; then | |
| ./dist/bin/post-to-slack.sh audit-results.json --format detailed | |
| else | |
| echo "⚠️ SLACK_WEBHOOK_URL not configured" | |
| fi | |
| - name: Upload results on failure | |
| if: failure() || steps.audit.outputs.exit_code != '0' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: failed-audit-results | |
| path: audit-results.json | |
| retention-days: 30 | |
| - name: Fail workflow if audit failed | |
| if: steps.audit.outputs.exit_code != '0' | |
| run: exit 1 | |