Skip to content

Commit 2c49948

Browse files
authored
ci: attribute cherry-pick/backport PRs to the requesting user (#24195)
The cherry-pick and backport workflows create PRs under `github-actions[bot]`. Since GitHub doesn't support creating PRs on behalf of another user, this adds attribution to the user who added the label (`github.event.sender.login`): - **Assignee**: the labeler is assigned to the backport PR - **Reviewer**: the labeler is added as a reviewer - **PR body**: includes "Requested by: @user" Applied to both `cherry-pick.yaml` and `backport.yaml`. --- > Generated by Coder Agents
1 parent 33d9d0d commit 2c49948

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/backport.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ jobs:
8484
PR_TITLE: ${{ github.event.pull_request.title }}
8585
PR_URL: ${{ github.event.pull_request.html_url }}
8686
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
87+
SENDER: ${{ github.event.sender.login }}
8788
steps:
8889
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
8990
with:
@@ -139,6 +140,7 @@ jobs:
139140
140141
Original PR: #${PR_NUMBER} — ${PR_TITLE}
141142
Merge commit: ${MERGE_SHA}
143+
Requested by: @${SENDER}
142144
EOF
143145
)
144146
@@ -171,4 +173,6 @@ jobs:
171173
--base "$RELEASE_VERSION" \
172174
--head "$BACKPORT_BRANCH" \
173175
--title "$TITLE" \
174-
--body "$BODY"
176+
--body "$BODY" \
177+
--assignee "$SENDER" \
178+
--reviewer "$SENDER"

.github/workflows/cherry-pick.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ jobs:
4242
PR_TITLE: ${{ github.event.pull_request.title }}
4343
PR_URL: ${{ github.event.pull_request.html_url }}
4444
MERGE_SHA: ${{ github.event.pull_request.merge_commit_sha }}
45+
SENDER: ${{ github.event.sender.login }}
4546
steps:
4647
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4748
with:
@@ -116,6 +117,7 @@ jobs:
116117
117118
Original PR: #${PR_NUMBER} — ${PR_TITLE}
118119
Merge commit: ${MERGE_SHA}
120+
Requested by: @${SENDER}
119121
EOF
120122
)
121123
@@ -136,4 +138,6 @@ jobs:
136138
--base "$RELEASE_BRANCH" \
137139
--head "$BACKPORT_BRANCH" \
138140
--title "$TITLE" \
139-
--body "$BODY"
141+
--body "$BODY" \
142+
--assignee "$SENDER" \
143+
--reviewer "$SENDER"

0 commit comments

Comments
 (0)