1313 type : string
1414 required : true
1515 default : main
16- workflow_call :
16+ workflow_call :
1717 inputs :
1818 product_name :
1919 type : string
@@ -31,37 +31,38 @@ permissions:
3131
3232
3333jobs :
34- # check-if-allowed:
35- # if: ${{ ( github.repository_owner == 'nginx' || github.repository_owner == 'nginxinc' ) }}
36- # runs-on: [ ubuntu-latest ]
37- # steps:
38- # - name: Check if we're in the allowed environment
39- # run: |
40- # org_found=0
41- # event_found=0
42- # ref_found=0
43- # ALLOWED_ORGS="nginx nginxinc"
44- # ALLOWED_EVENTS="push"
45- # ALLOWED_REFS="refs/heads/main refs/heads/master refs/heads/stable-1.28"
46- # for org in $ALLOWED_ORGS; do
47- # if [ "$org" == "$GITHUB_REPOSITORY_OWNER" ]; then org_found=1; fi
48- # done
49- # for event in $ALLOWED_EVENTS; do
50- # if [ "$event" == "$GITHUB_EVENT_NAME" ]; then event_found=1; fi
51- # done
52- # for ref in $ALLOWED_REFS; do
53- # if [ "$ref" == "$GITHUB_REF" ]; then ref_found=1; fi
54- # done
55- # if [ $org_found$event_found$ref_found -ne 111 ]; then
56- # echo "Repository owner, event, or ref are not explicitely allowed to use this workflow: $GITHUB_REPOSITORY_OWNER, $GITHUB_EVENT_NAME, $GITHUB_REF"
57- # exit 1
58- # fi
59- # exit 0
34+ check-if-allowed :
35+ name : Verify Environment
36+ if : ${{ ( github.repository_owner == 'nginx' || github.repository_owner == 'nginxinc' ) }}
37+ runs-on : [ ubuntu-latest ]
38+ steps :
39+ - name : Check if we're in the allowed environment
40+ run : |
41+ org_found=0
42+ event_found=0
43+ ref_found=0
44+ ALLOWED_ORGS="nginx nginxinc"
45+ ALLOWED_EVENTS="push"
46+ ALLOWED_REFS="refs/heads/main refs/heads/master refs/heads/stable-1.28"
47+ for org in $ALLOWED_ORGS; do
48+ if [ "$org" == "$GITHUB_REPOSITORY_OWNER" ]; then org_found=1; fi
49+ done
50+ for event in $ALLOWED_EVENTS; do
51+ if [ "$event" == "$GITHUB_EVENT_NAME" ]; then event_found=1; fi
52+ done
53+ for ref in $ALLOWED_REFS; do
54+ if [ "$ref" == "$GITHUB_REF" ]; then ref_found=1; fi
55+ done
56+ if [ $org_found$event_found$ref_found -ne 111 ]; then
57+ echo "Repository owner, event, or ref are not explicitely allowed to use this workflow: $GITHUB_REPOSITORY_OWNER, $GITHUB_EVENT_NAME, $GITHUB_REF"
58+ exit 1
59+ fi
60+ exit 0
6061
6162 scan :
6263 name : Mend
6364 runs-on : ubuntu-22.04
64- # needs: check-if-allowed
65+ needs : check-if-allowed
6566 steps :
6667 - name : Checkout Repository
6768 uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -117,7 +118,7 @@ jobs:
117118 - name : Check if report is generated
118119 shell : bash
119120 run : |
120- file=$(find . -type f -regex ".*/$PROJECT_NAME.*scan_report\.json" | head -n 1)
121+ file=$(find . -type f -regex ".*/${ PROJECT_NAME} .*scan_report\.json" | head -n 1)
121122 echo -e "\nFound Mend scan log file - $file\n"
122123
123124
0 commit comments