WIP Libaaec 38 migrate from circle ci to GitHub actions to handle ci #34
This file contains 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: Ensure Bundler-Audit Passes | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
bundler-audit: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Ruby | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
# Step 3: Install Dependencies | |
- name: Install Dependencies | |
run: bundle install | |
# Step 4: Run Bundler-Audit | |
- name: Run Bundler-Audit | |
id: bundler-audit | |
run: | | |
mkdir -p tmp | |
bundle exec bundler-audit check --update > tmp/bundler-audit-output.txt || true | |
# Step 5: Analyze Bundler-Audit Output | |
- name: Analyze Bundler-Audit Output | |
run: | | |
if grep -Eq '^Name:|Critical|High' tmp/bundler-audit-output.txt; then | |
echo "High or Critical vulnerabilities detected!" | |
exit 1 | |
else | |
echo "No High or Critical vulnerabilities detected." | |
fi | |
# Step 6: Upload Bundler-Audit Report | |
- name: Upload Bundler-Audit Report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bundler-audit-report | |
path: tmp/bundler-audit-output.txt |