-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
41 lines (33 loc) · 1.13 KB
/
action.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
40
41
name: 'Auto assign author'
description: 'Automatically assign the author of a pull request to the pull request.'
inputs:
github-token:
description: 'GitHub token to use. If passed, takes precedence over the `app-id` and `app-private-key` inputs.'
app-id:
description: 'The app ID of the app.'
private-key:
description: 'The private key of the app.'
runs:
using: composite
steps:
- uses: actions/checkout@v4
- uses: ./get-github-token
id: token
with:
github-token: ${{ inputs.github-token }}
app-id: ${{ inputs.app-id }}
private-key: ${{ inputs.private-key }}
- name: 'Assign author if none are assigned'
uses: actions/github-script@v6
with:
github-token: ${{ steps.token.outputs.token }}
script: |
if (context.payload.pull_request.assignees.length > 0) {
return;
}
const author = context.payload.pull_request.user.login;
github.rest.issues.addAssignees({
...context.repo,
issue_number: context.payload.pull_request.number,
assignees: [author],
});