@@ -10,9 +10,39 @@ permissions:
10
10
id-token : write # This is required for requesting the JWT
11
11
12
12
jobs :
13
- codestyle-doc-tests :
13
+ collab-check :
14
+ runs-on : ubuntu-latest
15
+ outputs :
16
+ approval-env : ${{ steps.collab-check.outputs.result }}
17
+ steps :
18
+ - name : Collaborator Check
19
+ uses : actions/github-script@v7
20
+ id : collab-check
21
+ with :
22
+ result-encoding : string
23
+ script : |
24
+ try {
25
+ const res = await github.rest.repos.checkCollaborator({
26
+ owner: context.repo.owner,
27
+ repo: context.repo.repo,
28
+ username: "${{ github.event.pull_request.user.login }}",
29
+ });
30
+ console.log("Verifed ${{ github.event.pull_request.user.login }} is a repo collaborator. Auto Approving PR Checks.")
31
+ return res.status == "204" ? "auto-approve" : "manual-approval"
32
+ } catch (error) {
33
+ console.log("${{ github.event.pull_request.user.login }} is not a collaborator. Requiring Manual Approval to run PR Checks.")
34
+ return "manual-approval"
35
+ }
36
+ wait-for-approval :
14
37
runs-on : ubuntu-latest
38
+ needs : [collab-check]
39
+ environment : ${{ needs.collab-check.outputs.approval-env }}
15
40
steps :
41
+ - run : echo "Workflow Approved! Starting PR Checks."
42
+ codestyle-doc-tests :
43
+ runs-on : ubuntu-latest
44
+ needs : [wait-for-approval]
45
+ steps :
16
46
- name : Configure AWS Credentials
17
47
uses : aws-actions/configure-aws-credentials@v4
18
48
with :
23
53
uses : aws-actions/aws-codebuild-run-build@v1
24
54
with :
25
55
project-name : sagemaker-python-sdk-ci-codestyle-doc-tests
26
- source-version-override : ' pr/ ${{ github.event.pull_request.number }}'
56
+ source-version-override : ' refs/pull/ ${{ github.event.pull_request.number }}/head^{${{ github.event.pull_request.head.sha } }}'
27
57
unit-tests :
28
58
runs-on : ubuntu-latest
59
+ needs : [wait-for-approval]
29
60
strategy :
30
61
fail-fast : false
31
62
matrix :
41
72
uses : aws-actions/aws-codebuild-run-build@v1
42
73
with :
43
74
project-name : sagemaker-python-sdk-ci-unit-tests
44
- source-version-override : ' pr/ ${{ github.event.pull_request.number }}'
75
+ source-version-override : ' refs/pull/ ${{ github.event.pull_request.number }}/head^{${{ github.event.pull_request.head.sha } }}'
45
76
env-vars-for-codebuild : |
46
77
PY_VERSION
47
78
env :
0 commit comments