Add reusable team-guard action and decouple it from the AI review workflow - #52
Merged
Merged
Conversation
Several repositories duplicate the same inline curl check to restrict workflows to members of an organization team. Centralize it so the guard policy can evolve in one place. Only state=active memberships pass; pending invitations are rejected. require_membership=false turns the hard failure into an is_member output for callers that gate jobs themselves.
The membership check is no longer coupled to the AI review flow. Inputs, outputs and secrets of the reusable workflow are unchanged, so callers need no update.
mattgoud
approved these changes
Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The "only members of team X may trigger this" check is now duplicated in several places: inline in three PrestaShop/PrestaShop workflows (
create-build-branch,sync-from-upstream,version-branch-bootstrap) and inside theai-guarded-reviewreusable workflow here. Every copy hardcodes the same curl call, and changing the guard policy means touching every repository.What
New composite action
.github/actions/team-guardusable from any workflow as a single step:orgdefaults to the repository owner and can be overridden (needed for workflows that also run on forks/mirrors).actordefaults togithub.actorand can be overridden (the AI review flow passesgithub.event.sender.login).require_membership: falseswitches to report-only mode: the step never fails and exposes anis_memberoutput, for callers that gate jobs themselves.ai-guarded-review.ymlrefactored to use the action in itscheck-membershipjob (report-only mode, since thegatejob evaluates the result and manages labels). The reusable workflow's inputs, outputs and secrets are unchanged —ps_apiresourcesand other callers need no update.Rollout
Once this is merged:
sync-releasestrigger with this actionHow to test
Trigger an AI review from
ps_apiresources(add theNeed AI reviewlabel as a prestashop-sa member): behavior identical to before. As a non-member, the guard still removes the label and fails.