-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4da661d
commit b458c5c
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: 'Auto assign author' | ||
description: 'Automatically assign the author of a pull request to the pull request.' | ||
|
||
inputs: | ||
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@v3 | ||
|
||
- uses: ./get-github-token | ||
id: token | ||
with: | ||
token: ${{ inputs.token }} | ||
app-id: ${{ inputs.app-id }} | ||
private-key: ${{ inputs.private-key }} | ||
|
||
- name: 'Assign author if none are assigned' | ||
uses: actions/github-script@v6 | ||
with: | ||
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], | ||
}); |