-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
53 lines (44 loc) · 1.51 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: "Run Bundler Audit"
description: "Runs bundle-audit check --update and outputs results."
inputs:
ignore_list:
description: "Space-separated list of CVEs to ignore (e.g., CVE-2023-26141 CVE-2021-41182 CVE-2021-41183)"
required: false
default: ""
outputs:
has_vulnerabilities:
description: "True if vulnerabilities are found, false otherwise"
value: ${{ steps.check_vulnerabilities.outputs.has_vulnerabilities }}
audit_output:
description: "The full output from bundle-audit"
value: ${{ steps.check_vulnerabilities.outputs.audit_output }}
runs:
using: "composite"
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
- name: Install Bundler Audit
run: gem install bundler-audit
shell: bash
- name: Run Bundler Audit
id: audit
run: |
ignore_flag=""
if [ -n "${{ inputs.ignore_list }}" ]; then
ignore_flag="--ignore ${{ inputs.ignore_list }}"
fi
bundle-audit check --update $ignore_flag > audit_output.txt || true
shell: bash
- name: Check for Vulnerabilities
id: check_vulnerabilities
run: |
if grep -q "Vulnerabilities found!" audit_output.txt; then
echo "has_vulnerabilities=true" >> $GITHUB_OUTPUT
else
echo "has_vulnerabilities=false" >> $GITHUB_OUTPUT
fi
audit_output=$(jq -Rs . < audit_output.txt)
echo "audit_output=$audit_output" >> $GITHUB_OUTPUT
shell: bash