Skip to content

Commit

Permalink
required-review: Avoid requesting reviews from bots (#39895)
Browse files Browse the repository at this point in the history
Attempting to request a review from a bot account will likely fail, as
bot accounts are not "collaborators".

Fortunately a bot account is probably going to look like
`@something[bot]`, so we can look for that to exclude them without
having to make extra API queries.
  • Loading branch information
anomiex authored Oct 25, 2024
1 parent 4f0039e commit ac3ba4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Avoid trying to request reviews from bot accounts.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ async function requestReviewer( teams ) {
const teamReviews = [];

for ( const t of teams ) {
if ( t.startsWith( '@' ) ) {
if ( t.startsWith( '@' ) && t.endsWith( '[bot]' ) ) {
core.info( `Skipping ${ t }, appears to be a bot` );
} else if ( t.startsWith( '@' ) ) {
userReviews.push( t.slice( 1 ) );
} else {
teamReviews.push( t );
Expand Down

0 comments on commit ac3ba4a

Please sign in to comment.