Skip to content

Commit d2d80b5

Browse files
authored
Add PR assignment to commenter in workflow
1 parent 7065595 commit d2d80b5

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/create-changelog-pr.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,27 @@ jobs:
137137
labels: ['ready-for-doc-review']
138138
});
139139
140+
- name: Assign PR to commenter
141+
if: env.CONTINUE_WORKFLOW == 'true'
142+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
143+
env:
144+
# Reuse the PR number captured earlier
145+
PULL_REQUEST_NUMBER: ${{ steps.create_pull_request.outputs.pull-request-number }}
146+
with:
147+
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
148+
script: |
149+
try {
150+
const username = context.payload.comment.user.login;
151+
await github.rest.issues.addAssignees({
152+
owner: context.repo.owner,
153+
repo: context.repo.repo,
154+
issue_number: Number(process.env.PULL_REQUEST_NUMBER),
155+
assignees: [username]
156+
});
157+
} catch (err) {
158+
core.info(`Failed to assign PR to @${context.payload.comment.user.login}: ${err.message}`);
159+
}
160+
140161
- uses: ./.github/actions/slack-alert
141162
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
142163
with:

0 commit comments

Comments
 (0)