Skip to content

Commit af7af51

Browse files
ci: Fix FOSSA scans by generating Gemfile.lock files before scanning (#1640)
Shell script will loop through all the available Gemfiles in this repository and create Gemfile.lock files without actually installing these gems. Some folders like */examples/* and release/ have been vomited. FOSSA is intelligent enough to read nested directories and generate the report based on lock files. Signed-off-by: Arjun Rajappa <[email protected]> Co-authored-by: Kayla Reopelle <[email protected]>
1 parent 369c200 commit af7af51

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/fossa.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,33 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493 # v4.2.2
1717

18+
- name: Install Ruby 3.4
19+
uses: ruby/[email protected]
20+
with:
21+
ruby-version: 3.4
22+
- name: Generate Gemfile.lock
23+
run: |
24+
echo "Finding all Gemfiles in the project..."
25+
echo "======================================="
26+
ORIGINAL_DIR=$(pwd)
27+
28+
find . -type f -name "Gemfile" -not -path "*/example/*" -not -path "*/releases/*" | sort | while read gemfile; do
29+
gemfile_dir=$(dirname "$gemfile")
30+
31+
# Change to the Gemfile's directory
32+
echo "Changing to directory: $gemfile_dir"
33+
34+
cd "$gemfile_dir" || continue
35+
36+
echo "Current directory: $(pwd)"
37+
echo "Creating lock file for: $gemfile"
38+
39+
# Generate the gemlock files
40+
bundle lock || echo "Warning: Failed to generate lock file for $gemfile, continuing..."
41+
42+
cd "$ORIGINAL_DIR" || exit 1
43+
done
44+
1845
- uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0
1946
with:
2047
api-key: ${{secrets.FOSSA_API_KEY}}

0 commit comments

Comments
 (0)