Skip to content

Remove Type field details addition in sync-bug-triage-github-project-beta.sh #2788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 6 additions & 27 deletions release-team/hack/sync-bug-triage-github-project-beta.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,8 @@ milestone_pr_ids=()

## Function definitions

function get_field_ids_from_github_beta_project() {
if [ "$1" == "project-id" ]
then
query='.data.organization.projectV2.id'
elif [ "$1" == "type-id" ]
then
query='.data.organization.projectV2.fields.nodes[] | select(.name== "Type") | .id'
elif [ "$1" == "issue-id" ]
then
query='.data.organization.projectV2.fields.nodes[] | select(.name== "Type") | .options[] | select(.name== "Issue") | .id'
# for "pr-id"
else
query='.data.organization.projectV2.fields.nodes[] | select(.name== "Type") | .options[] | select(.name== "PR") | .id'
fi
function get_project_id_from_github_beta_project() {
query='.data.organization.projectV2.id'

ID="$( gh api graphql -f query='
query($org: String!, $number: Int!) {
Expand Down Expand Up @@ -96,22 +84,16 @@ function add_items_to_github_beta_project {
mutation (
$project: ID!
$item: ID!
$type_field: ID!
$option_id: String!
) {
set_issue_type: updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $type_field
value: {
singleSelectOptionId: $option_id
}
}) {
projectV2Item {
id
}
}
}' -f project="${PROJECT_ID}" -f item="${1}" -f type_field="${TYPE_FIELD_ID}" -f option_id="${2}" --silent
}' -f project="${PROJECT_ID}" -f item="${1}" --silent
}


Expand Down Expand Up @@ -191,10 +173,7 @@ done
## Fetch Project metadata
echo -e "[INFO] Getting metadata for the Bug Triage GitHub Beta Project with ID: ${PROJECT_NUMBER}"

PROJECT_ID=$( get_field_ids_from_github_beta_project "project-id")
TYPE_FIELD_ID=$( get_field_ids_from_github_beta_project "type-id")
ISSUE_OPTION_ID=$( get_field_ids_from_github_beta_project "issue-id")
PR_OPTION_ID=$( get_field_ids_from_github_beta_project "pr-id")
PROJECT_ID=$( get_project_id_from_github_beta_project)


## Add data to the Project Board
Expand All @@ -213,7 +192,7 @@ do
}
}' -f project="${PROJECT_ID}" -f issue="${issue_id}" --jq '.data.addProjectV2ItemById.item.id')"

add_items_to_github_beta_project "${item_id}" "${ISSUE_OPTION_ID}"
add_items_to_github_beta_project "${item_id}"
fi
done

Expand All @@ -232,7 +211,7 @@ do
}
}' -f project="${PROJECT_ID}" -f pr="${pr_id}" --jq '.data.addProjectV2ItemById.item.id')"

add_items_to_github_beta_project "${item_id}" "${PR_OPTION_ID}"
add_items_to_github_beta_project "${item_id}"
fi
done

Expand Down