File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,36 @@ name: Python package
66on : [push, pull_request]
77
88jobs :
9+ collab-check :
10+ runs-on : ubuntu-latest
11+ outputs :
12+ approval-env : ${{ steps.collab-check.outputs.result }}
13+ steps :
14+ - name : Collaborator Check
15+ uses : actions/github-script@v7
16+ id : collab-check
17+ with :
18+ github-token : ${{ secrets.COLLAB_CHECK_TOKEN }}
19+ result-encoding : string
20+ script : |
21+ try {
22+ const res = await github.rest.repos.checkCollaborator({
23+ owner: context.repo.owner,
24+ repo: context.repo.repo,
25+ username: "${{ github.event.pull_request.user.login }}",
26+ });
27+ console.log("Verifed ${{ github.event.pull_request.user.login }} is a repo collaborator. Auto Approving PR Checks.")
28+ return res.status == "204" ? "auto-approve" : "manual-approval"
29+ } catch (error) {
30+ console.log("${{ github.event.pull_request.user.login }} is not a collaborator. Requiring Manual Approval to run PR Checks.")
31+ return "manual-approval"
32+ }
33+ wait-for-approval :
34+ runs-on : ubuntu-latest
35+ needs : [collab-check]
36+ environment : ${{ needs.collab-check.outputs.approval-env }}
37+ steps :
38+ - run : echo "Workflow Approved! Starting PR Checks."
939 test :
1040 runs-on : ubuntu-latest
1141 strategy :
You can’t perform that action at this time.
0 commit comments