File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ---
Original file line number Diff line number Diff line change @@ -37,8 +37,39 @@ concurrency:
3737 cancel-in-progress : true
3838
3939jobs :
40+ permissions-check :
41+ name : Check Permissions
42+ runs-on : ' blacksmith-8vcpu-ubuntu-2204'
43+ steps :
44+ - name : Check org membership
45+ uses : actions/github-script@v7
46+ with :
47+ script : |
48+ const org = context.repo.owner;
49+ const username = process.env.GITHUB_TRIGGERING_ACTOR || context.actor;
50+
51+ try {
52+ const { status } = await github.rest.orgs.checkMembershipForUser({
53+ org,
54+ username,
55+ });
56+
57+ if (status !== 204) {
58+ core.setFailed(`User '${username}' is not a member of the '${org}' organization.`);
59+ }
60+ } catch (error) {
61+ if (error?.status === 404) {
62+ core.setFailed(`User '${username}' is not a member of the '${org}' organization.`);
63+ } else {
64+ core.setFailed(
65+ `Org membership check failed for '${username}' in '${org}' (status: ${error?.status ?? 'unknown'}): ${error?.message ?? 'unknown error'}`
66+ );
67+ }
68+ }
69+
4070 validate-instances :
4171 name : Validate Staging Instances
72+ needs : [permissions-check]
4273 runs-on : ' blacksmith-8vcpu-ubuntu-2204'
4374 steps :
4475 - name : Checkout Repo
5687
5788 integration-tests :
5889 name : Integration Tests (${{ matrix.test-name }}, ${{ matrix.test-project }})
90+ needs : [permissions-check]
5991 runs-on : ' blacksmith-8vcpu-ubuntu-2204'
6092 defaults :
6193 run :
You can’t perform that action at this time.
0 commit comments