File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
118141export 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,
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { graphql } from '@octokit/graphql'
33import {
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
You can’t perform that action at this time.
0 commit comments