File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 required : false
77 type : string
88 default : ' stable'
9-
9+ backport-team :
10+ required : true
11+ type : string
12+ description : ' The org/team-slug allowed to trigger /backport (e.g. my-org/my-team)'
1013permissions :
1114 contents : write
1215 pull-requests : write
13-
1416jobs :
1517 backport :
1618 name : Backport
1719 runs-on : ubuntu-latest
1820 # Only run if:
1921 # - triggered by pull request merging, or
20- # - a label starting with ` backport ` is added to a merged PR, or
21- # - `/backport` commented on a PR by someone other than "Sei Platform / Code Agent" GitHub App.
22+ # - `/ backport` commented on a PR by someone other than the bot
23+ # (team membership is verified in a later step)
2224 if : >
2325 (
2426 github.event_name == 'pull_request_target' &&
3638 with :
3739 app-id : ${{ secrets.PLATFORM_CODE_AGENT_APP_ID }}
3840 private-key : ${{ secrets.PLATFORM_CODE_AGENT_APP_PK }}
39-
41+ - name : Check team membership for /backport comments
42+ if : github.event_name == 'issue_comment'
43+ env :
44+ GH_TOKEN : ${{ steps.generate-token.outputs.token }}
45+ ORG_TEAM : ${{ inputs.backport-team }}
46+ COMMENT_USER : ${{ github.event.comment.user.login }}
47+ run : |
48+ ORG="${ORG_TEAM%%/*}"
49+ TEAM="${ORG_TEAM##*/}"
50+ if ! gh api "orgs/${ORG}/teams/${TEAM}/memberships/${COMMENT_USER}" --silent; then
51+ echo "::error::User ${COMMENT_USER} is not a member of ${ORG}/${TEAM}"
52+ exit 1
53+ fi
54+ echo "User ${COMMENT_USER} is a member of ${ORG_TEAM}"
4055 - uses : actions/checkout@v6
4156 - name : Create backport pull requests
4257 uses : korthout/backport-action@v4.3.0
You can’t perform that action at this time.
0 commit comments