Skip to content

Commit 48b7036

Browse files
Handle bot authors (e.g. dependabot[bot]) in ready-for-docs-review (#60194)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mario-campos <1663284+mario-campos@users.noreply.github.com>
1 parent aae6f16 commit 48b7036

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/workflows/ready-for-docs-review.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,16 @@ async function run() {
155155
const size = getSize(data)
156156
const sizeType = findSingleSelectID(size, 'Size', data)
157157

158+
// Check if the author is a bot account (e.g. dependabot[bot], github-actions[bot]).
159+
// GitHub bot logins end with '[bot]' and cannot be resolved as regular GitHub users,
160+
// so we skip any user-specific GraphQL queries for them.
161+
const isBotAuthor = (process.env.AUTHOR_LOGIN || '').endsWith('[bot]')
162+
158163
// If this is the OS repo, determine if this is a first time contributor
159164
// If yes, set the author to 'first time contributor' instead of to the author login
165+
// Bot accounts (e.g. dependabot[bot]) are not resolvable as GitHub users, so skip this check.
160166
let firstTimeContributor
161-
if (process.env.REPO === 'github/docs') {
167+
if (!isBotAuthor && process.env.REPO === 'github/docs') {
162168
const contributorData: Record<string, unknown> = await graphql(
163169
`
164170
query ($author: String!) {
@@ -242,8 +248,8 @@ async function run() {
242248

243249
// Determine which variable to use for the contributor type
244250
let contributorType
245-
if (isCopilotAuthor) {
246-
// Treat Copilot PRs as Docs team
251+
if (isCopilotAuthor || isBotAuthor) {
252+
// Treat Copilot and bot-authored PRs (e.g. dependabot[bot]) as Docs team
247253
contributorType = docsMemberTypeID
248254
} else if (await isDocsTeamMember(process.env.AUTHOR_LOGIN || '')) {
249255
contributorType = docsMemberTypeID

0 commit comments

Comments
 (0)