Skip to content

Commit 57fdbc2

Browse files
committed
ci(e2e): add org membership check to e2e-staging workflow
1 parent ad782ff commit 57fdbc2

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

.github/workflows/e2e-staging.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,33 @@ concurrency:
3737
cancel-in-progress: true
3838

3939
jobs:
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 = 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+
core.setFailed(`User '${username}' is not a member of the '${org}' organization.`);
62+
}
63+
4064
validate-instances:
4165
name: Validate Staging Instances
66+
needs: [permissions-check]
4267
runs-on: 'blacksmith-8vcpu-ubuntu-2204'
4368
steps:
4469
- name: Checkout Repo
@@ -56,6 +81,7 @@ jobs:
5681

5782
integration-tests:
5883
name: Integration Tests (${{ matrix.test-name }}, ${{ matrix.test-project }})
84+
needs: [permissions-check]
5985
runs-on: 'blacksmith-8vcpu-ubuntu-2204'
6086
defaults:
6187
run:

0 commit comments

Comments
 (0)