Skip to content

Commit 9c3301c

Browse files
committed
CI_CLOUD PR label override for trivy scan
1 parent 151746c commit 9c3301c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

.github/workflows/trivyscan.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ jobs:
2525
steps:
2626
- uses: actions/checkout@v2
2727

28+
- name: Override CI_CLOUD if PR label is present
29+
if: ${{ github.event_name == 'pull_request' }}
30+
run: |
31+
# Iterate over the labels
32+
labels=$(echo '${{ toJSON(github.event.pull_request.labels) }}' | jq -r '.[].name')
33+
echo $labels
34+
for label in $labels; do
35+
if [[ $label == CI_CLOUD=* ]]; then
36+
# Extract the value after 'CI_CLOUD='
37+
CI_CLOUD_OVERRIDE=${label#CI_CLOUD=}
38+
echo "CI_CLOUD=${CI_CLOUD_OVERRIDE}" >> $GITHUB_ENV
39+
fi
40+
done
41+
2842
- name: Record settings for CI cloud
2943
run: |
3044
echo CI_CLOUD: ${{ env.CI_CLOUD }}

0 commit comments

Comments
 (0)