Skip to content

Commit 0e59ad2

Browse files
ci: Fix FOSSA scans by generating Gemfile.lock files before scanning (#1900)
Shell script will loop through all the available Gemfiles in this repository and create Gemfile.lock files without actually installing these gems. Folder */examples/* has 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]>
1 parent 4b27507 commit 0e59ad2

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

.github/workflows/fossa.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,34 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1717

18-
- uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0
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/*" | 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+
45+
- uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0
1946
with:
2047
api-key: ${{secrets.FOSSA_API_KEY}}
2148
team: OpenTelemetry

0 commit comments

Comments
 (0)