An open source design system that's fully customizable and agent ready
TypeScript
fix(ci): recognize repository maintainers for visual acceptance (#5591)
Cindy Zhang6f7da5ca9d39
diff --git a/.github/scripts/visual-gate/workflow-concurrency.test.mjs b/.github/scripts/visual-gate/workflow-concurrency.test.mjsindex 0833383f93..56dd491721 100644--- a/.github/scripts/visual-gate/workflow-concurrency.test.mjs+++ b/.github/scripts/visual-gate/workflow-concurrency.test.mjs@@ -109,6 +109,18 @@ describe('visual acceptance workflow concurrency', () => {expect(capture).not.toContain('GITHUB_RUN_ATTEMPT:');});+ it('normalizes GitHub role flags before authorizing a maintainer', () => {+ const value = workflow('visual-acceptance.yml');+ const authorize = value.slice(+ value.indexOf(' authorize:'),+ value.indexOf(' accept:'),+ );++ expect(authorize).toContain('actor.permissions?.admin');+ expect(authorize).toContain('actor.permissions?.maintain');+ expect(authorize).toContain("? 'maintain'");+ });+it('uses the same head identity for post-merge promotion', () => {const value = workflow('visual-acceptance-promote.yml');diff --git a/.github/workflows/visual-acceptance.yml b/.github/workflows/visual-acceptance.ymlindex 067eb5f601..f03b30457e 100644--- a/.github/workflows/visual-acceptance.yml+++ b/.github/workflows/visual-acceptance.yml@@ -170,7 +170,12 @@ jobs:const response = await github.rest.repos.getCollaboratorPermissionLevel({owner, repo, username: context.actor,});- permission = response.data.user.permission;+ const actor = response.data.user;+ permission = actor.permissions?.admin+ ? 'admin'+ : actor.permissions?.maintain+ ? 'maintain'+ : actor.permission;} catch (error) {if (error.status !== 404) throw error;}