Skip to content

Commit ed92a75

Browse files
Sarah Edwardsheiskr
andauthored
Classify hubber PRs as hubber contributions even in the OS repo (#23987)
Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
1 parent 6965b3d commit ed92a75

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

.github/actions-scripts/projects.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,29 @@ export async function isDocsTeamMember(login) {
114114
return teamMembers.includes(login)
115115
}
116116

117+
// Given a GitHub login, returns a bool indicating
118+
// whether the login is part of the GitHub org
119+
export async function isGitHubOrgMember(login) {
120+
const data = await graphql(
121+
`
122+
query {
123+
user(login: "${login}") {
124+
organization(login: "github"){
125+
name
126+
}
127+
}
128+
}
129+
`,
130+
{
131+
headers: {
132+
authorization: `token ${process.env.TOKEN}`,
133+
},
134+
}
135+
)
136+
137+
return Boolean(data.user.organization)
138+
}
139+
117140
// Formats a date object into the required format for projects
118141
export function formatDateForProject(date) {
119142
return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
@@ -246,6 +269,7 @@ export default {
246269
addItemsToProject,
247270
addItemToProject,
248271
isDocsTeamMember,
272+
isGitHubOrgMember,
249273
findFieldID,
250274
findSingleSelectID,
251275
formatDateForProject,

.github/actions-scripts/ready-for-docs-review.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { graphql } from '@octokit/graphql'
33
import {
44
addItemToProject,
55
isDocsTeamMember,
6+
isGitHubOrgMember,
67
findFieldID,
78
findSingleSelectID,
89
generateUpdateProjectNextItemFieldMutation,
@@ -178,9 +179,12 @@ async function run() {
178179
let contributorType
179180
if (await isDocsTeamMember(process.env.AUTHOR_LOGIN)) {
180181
contributorType = docsMemberTypeID
182+
} else if (await isGitHubOrgMember(process.env.AUTHOR_LOGIN)) {
183+
contributorType = hubberTypeID
181184
} else if (process.env.REPO === 'github/docs') {
182185
contributorType = osContributorTypeID
183186
} else {
187+
// use hubber as the fallback so that the PR doesn't get lost on the board
184188
contributorType = hubberTypeID
185189
}
186190

0 commit comments

Comments
 (0)