File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 11name : " Pull Assign"
22description : " a Github action to assign a PR to the author"
3+ inputs :
4+ bot-assignee :
5+ description : A user to assign bot-authored PRs to.
6+ required : false
37runs :
48 using : node20
59 main : " dist/index.js"
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ const github = require('@actions/github')
33const { Octokit } = require ( "@octokit/action" )
44
55async function run ( ) {
6+ const botAssignee = core . getInput ( 'bot-assignee' ) || null
7+
68 const client = new Octokit ( )
79 const owner = github . context . payload . repository . owner . login
810 const repo = github . context . payload . repository . name
@@ -17,7 +19,15 @@ async function run() {
1719
1820 if ( ! assignees || assignees . length === 0 ) {
1921 if ( author . is_bot || ( author . type && author . type === 'Bot' ) ) {
20- console . log ( `PR was created by a bot (${ author . login } ). No assignee added.` )
22+ if ( botAssignee ) {
23+ console . log ( `PR was created by a bot (${ author . login } ). Assigning ${ botAssignee } .` )
24+ await client . request (
25+ `POST /repos/${ owner } /${ repo } /issues/${ issue_number } /assignees` ,
26+ { owner, repo, issue_number, assignees : [ botAssignee ] }
27+ )
28+ } else {
29+ console . log ( `PR was created by a bot (${ author . login } ), but no bot-assignee was provided. No assignee added.` )
30+ }
2131 } else {
2232 console . log ( `PR was created by a human (${ author . login } ). Assigning them.` )
2333 await client . request (
You can’t perform that action at this time.
0 commit comments