fix: use GitHub Teams for E2E test authorization#1117
Conversation
…RS secret Replace the AUTHORIZED_USERS secret-based check with a GitHub Teams membership check against aws/agentcore-devex-devs. The secret was silently overwritten on Apr 29, causing all E2E tests to skip on PRs with no visible error. Team membership is managed by org admins and changes are tracked in GitHub's org audit log, preventing silent overwrites. Requires a TEAM_CHECK_TOKEN secret (PAT with read:org scope) to query team membership via the GitHub API.
Silent-skip failure mode is reintroduced in the error handlerThe PR description explains the bug being fixed: when } catch (error) {
core.info(`⏭️ User ${context.actor} is not a member of aws/agentcore-devex-devs — skipping E2E tests.`);
core.info('ℹ️ External contributors: ask a maintainer to run the E2E tests manually via workflow_dispatch.');
core.setOutput('is_authorized', 'false');
}
In all of these cases, every E2E run will silently skip for every user — team members included — and the authorize job will report success. That's the exact behavior this PR is trying to prevent, just with a different root cause (PAT lifecycle / misconfig instead of secret overwrite). Suggested fixes (pick one)Option A — Discriminate on status code. Treat only } catch (error) {
if (error.status === 404) {
core.info(`⏭️ User ${context.actor} is not a member of aws/agentcore-devex-devs — skipping E2E tests.`);
core.info('ℹ️ External contributors: ask a maintainer to run the E2E tests manually via workflow_dispatch.');
core.setOutput('is_authorized', 'false');
return;
}
core.setFailed(`Team membership check failed (status ${error.status}): ${error.message}. Check that TEAM_CHECK_TOKEN is valid and has read:org scope.`);
}Option B — Fail-closed with a loud signal. Keep the current skip behavior but Option C — Use Option A is probably the right call — the whole point of this PR is to make auth failures visible rather than silent. |
|
Coverage Report
|
Summary
Replace the
AUTHORIZED_USERSsecret-based authorization check in the E2E Tests workflow with a GitHub Teams membership check againstaws/agentcore-devex-devs.Problem
The
AUTHORIZED_USERSrepo secret was silently overwritten on Apr 29, causing all E2E tests to skip on every PR since then with no visible error. The authorize job "passed" but setis_authorized=false, so the e2e job silently skipped. GitHub secrets are write-only — there's no way to see the current value or audit who changed it.Solution
Use the GitHub Teams API to check if the PR author is a member of
aws/agentcore-devex-devs:Setup Required
A repo admin needs to create a
TEAM_CHECK_TOKENsecret with a GitHub PAT that hasread:orgscope. This token is used to query team membership via the GitHub API.Changes
.github/workflows/e2e-tests.yml— Replace bash secret check withactions/github-script@v7team membership checkTest plan
TEAM_CHECK_TOKENsecret withread:orgPAT