-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (32 loc) · 1.2 KB
/
author-pr-assignment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Assign author to PR
on:
pull_request:
permissions:
issues: write
pull-requests: write
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
jobs:
assign-author-to-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const author = context.payload.pull_request.user.login;
const assignmentResult = await github.rest.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
assignee: [author],
});
core.debug(JSON.stringify(assignmentResult));
core.info(`@${author} has been assigned to the pull request: #${context.issue.number}`);
const assigneesResult = await github.rest.issues.listAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
core.debug(JSON.stringify(assigneeResult));
core.info(`Assignees for PR: ${JSON.stringify(assignees.data.map(({login}) => login))}`);