Skip to content

Commit 6ce4244

Browse files
committed
make changes to workflow
Signed-off-by: Sonu Saha <[email protected]>
1 parent db09e49 commit 6ce4244

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

.github/workflows/sbom.yml

+16-16
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,14 @@ jobs:
2626
-H "X-GitHub-Api-Version: 2022-11-28" \
2727
https://api.github.com/repos/${{ github.repository }}/dependency-graph/sbom \
2828
-o "${FILE_PREFIX}-sbom.json"
29+
continue-on-error: true
2930

3031
- name: Verify SBOM JSON File
3132
run: |
33+
if [ ! -f "${FILE_PREFIX}-sbom.json" ]; then
34+
echo "SBOM JSON file not found!"
35+
exit 1
36+
fi
3237
ls -l "${FILE_PREFIX}-sbom.json"
3338
3439
- name: Preview SBOM JSON Content
@@ -47,6 +52,7 @@ jobs:
4752
( .externalRefs[]? | .referenceLocator ),
4853
"None", "None", "None"
4954
] | @csv' "${FILE_PREFIX}-sbom.json" >> "${FILE_PREFIX}-sbom.csv"
55+
continue-on-error: true
5056

5157
- name: Preview SBOM CSV Content
5258
run: |
@@ -57,28 +63,18 @@ jobs:
5763
TEMP_CSV="${FILE_PREFIX}-sbom-temp.csv"
5864
echo "name,SPDXID,versionInfo,downloadLocation,externalRefs,license,source_code_url,vendor" > "$TEMP_CSV"
5965
tail -n +2 "${FILE_PREFIX}-sbom.csv" | while IFS=, read -r name SPDXID versionInfo downloadLocation externalRefs license source_code_url vendor; do
60-
# Debug each row
61-
echo "Processing: $name, $SPDXID, $versionInfo, $downloadLocation, $externalRefs, $license, $source_code_url, $vendor"
6266
if [[ "$externalRefs" == *"pkg:gem"* ]]; then
63-
echo "Processing RubyGem: $name"
6467
gem_name=$(echo "$name" | tr -d '"')
6568
version=$(echo "$versionInfo" | tr -d '"')
66-
# Check if the version contains a version constraint (e.g., ~>, >=, <=)
6769
if [[ "$versionInfo" =~ [\~\>\<\=\ ] ]]; then
68-
echo "Skipping call to rubygems.org for version constraint: $versionInfo"
69-
continue # Skip processing for this gem versionInfo
70+
continue
7071
else
71-
# Proceed with making the call to rubygems.org
72-
echo "Making call to rubygems.org for fixed version: $versionInfo"
73-
# Your logic to call rubygems.org
72+
api_url="https://rubygems.org/api/v2/rubygems/${gem_name}/versions/${version}.json"
73+
response=$(curl -s "$api_url")
74+
new_license=$(echo "$response" | jq -r '.licenses[0] // "None"')
75+
new_source_code_url=$(echo "$response" | jq -r '.source_code_uri // "None"')
76+
new_vendor=$(echo "$response" | jq -r '.authors // "None"')
7477
fi
75-
api_url="https://rubygems.org/api/v2/rubygems/${gem_name}/versions/${version}.json"
76-
response=$(curl -s "$api_url")
77-
echo "Response: $response"
78-
new_license=$(echo "$response" | jq -r '.licenses[0] // "None"')
79-
echo "License: $new_license"
80-
new_source_code_url=$(echo "$response" | jq -r '.source_code_uri // "None"')
81-
new_vendor=$(echo "$response" | jq -r '.authors // "None"')
8278
else
8379
new_license="None"
8480
new_source_code_url="None"
@@ -90,6 +86,10 @@ jobs:
9086
9187
- name: Verify SBOM CSV File
9288
run: |
89+
if [ ! -f "${FILE_PREFIX}-sbom.csv" ]; then
90+
echo "SBOM CSV file not found!"
91+
exit 1
92+
fi
9393
ls -l "${FILE_PREFIX}-sbom.csv"
9494
9595
- name: Upload SBOM JSON as Artifact

0 commit comments

Comments
 (0)