File tree Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Original file line number Diff line number Diff line change 11name : Black Duck Policy Check
22on :
3- push :
3+ pull_request :
4+ pull_request_target :
45 branches :
56 - main
6- pull_request_target :
7+ push :
78 branches :
89 - main
910
1011jobs :
12+ check_approvals :
13+ runs-on : ubuntu-latest
14+ # Run this job only if the following conditions are met:
15+ # 1. The pull request has the 'integration-test' label.
16+ # 2. The event is either:
17+ # a. A 'pull_request' event where the base and head repositories are the same (internal PR).
18+ # b. A 'pull_request_target' event where the base and head repositories are different (external PR).
19+ if : ${{ contains(github.event.pull_request.labels.*.name, 'integration-test') &&
20+ (( github.event_name == 'pull_request' && github.event.pull_request.base.repo.clone_url == github.event.pull_request.head.repo.clone_url) ||
21+ (github.event_name == 'pull_request_target' && github.event.pull_request.base.repo.clone_url != github.event.pull_request.head.repo.clone_url )) }}
22+ outputs :
23+ # Output the approval status for pull_request_target events, otherwise default to 'true'
24+ check_approvals : ${{ github.event_name == 'pull_request_target' && steps.check_approvals.outputs.check_approvals || 'true' }}
25+ # Output whether the PR is external
26+ external_pr : ${{ github.event.pull_request.base.repo.clone_url != github.event.pull_request.head.repo.clone_url }}
27+ steps :
28+ - name : Check integration test allowance status
29+ # Only run this step for pull_request_target events
30+ if : ${{ github.event_name == 'pull_request_target' }}
31+ id : check_approvals
32+ # Use an external action to check if the PR has the necessary approvals
33+ uses : nutanix-cloud-native/action-check-approvals@v1
1134 security :
12- if : github.repository == 'nutanix-cloud-native/cosi-driver-nutanix'
35+ needs : check_approvals
36+ if : ${{ (github.event_name == 'pull_request' && needs.check_approvals.outputs.external_pr == 'false') || (github.event_name == 'pull_request_target' && needs.check_approvals.outputs.external_pr == 'true' && needs.check_approvals.outputs.check_approvals == 'true') }}
1337 runs-on : ubuntu-latest
1438 permissions :
1539 actions : read
You can’t perform that action at this time.
0 commit comments