Improve vulnerability scanning #4
Workflow file for this run
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: Bundler Audit Security Check | |
| on: | |
| workflow_call: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| bundler-audit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.3' | |
| bundler-cache: true | |
| - name: Run Audit Check | |
| run: | | |
| gem install bundler-audit | |
| # Run audit and save output to file (preventing immediate job failure via || true) | |
| bundle-audit check --update > audit_results.txt || AUDIT_EXIT_CODE=$? | |
| echo "## 🛡️ Ruby Dependency Audit Summary" >> $GITHUB_STEP_SUMMARY | |
| if [ -z "$AUDIT_EXIT_CODE" ]; then | |
| echo "::notice::No vulnerabilities found in Ruby dependencies." | |
| echo "✅ **No vulnerabilities found!** All resolved gems from your `.gemspec` passed security checks." >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "⚠️ **Vulnerabilities Detected in Ruby Dependencies**" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo '```text' >> $GITHUB_STEP_SUMMARY | |
| cat audit_results.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| # Fail the step if vulnerabilities were found | |
| exit $AUDIT_EXIT_CODE | |
| fi |