Skip to content

Commit

Permalink
Update scripts for populating docs-content review board (github#20970)
Browse files Browse the repository at this point in the history
  • Loading branch information
skedwards88 authored Aug 23, 2021
1 parent 7ed5305 commit ab4ef61
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions .github/actions-scripts/fr-add-docs-reviewers-requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,14 @@ async function run() {
// Exclude existing items going forward.
// Until we have a way to check from a PR whether the PR is in a project,
// this is how we (roughly) avoid overwriting PRs that are already on the board
const newItemIDs = itemIDs.filter((id) => !existingItemIDs.includes(id))
let newItemIDs = []
let newItemAuthors = []
itemIDs.forEach((id, index) => {
if (!existingItemIDs.includes(id)) {
newItemIDs.push(id)
newItemAuthors.push(prAuthors[index])
}
})

if (newItemIDs.length === 0) {
console.log('All found PRs are already on the project. Exiting.')
Expand All @@ -145,11 +152,14 @@ async function run() {
for (const [index, itemID] of newItemIDs.entries()) {
const updateProjectNextItemMutation = generateUpdateProjectNextItemFieldMutation({
item: itemID,
author: prAuthors[index],
author: newItemAuthors[index],
turnaround: 2,
feature: 'OpenAPI schema update',
})
const contributorType = isDocsTeamMember(prAuthors[index]) ? docsMemberTypeID : hubberTypeID
console.log(`Populating fields for item: ${itemID}`)
const contributorType = (await isDocsTeamMember(newItemAuthors[index]))
? docsMemberTypeID
: hubberTypeID
console.log(`Populating fields for item: ${itemID} with author ${newItemAuthors[index]}`)

await graphql(updateProjectNextItemMutation, {
project: projectID,
Expand Down
2 changes: 1 addition & 1 deletion .github/actions-scripts/ready-for-docs-review.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async function run() {

// Determine which variable to use for the contributor type
let contributorType
if (isDocsTeamMember(process.env.AUTHOR_LOGIN)) {
if (await isDocsTeamMember(process.env.AUTHOR_LOGIN)) {
contributorType = docsMemberTypeID
} else if (process.env.PR_REPO === 'github/docs') {
contributorType = osContributorTypeID
Expand Down

0 comments on commit ab4ef61

Please sign in to comment.