1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-12-19 10:51:57 +00:00

ci: migrate to ProjectV2 GraphQL API (#11311)

This commit is contained in:
Lennart Ochel 2022-11-03 18:30:30 +01:00 committed by GitHub
parent 50a526f209
commit 239e2f9fcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,10 +27,11 @@ jobs:
gh api graphql -f query=' gh api graphql -f query='
query($org: String!, $number: Int!) { query($org: String!, $number: Int!) {
organization(login: $org){ organization(login: $org){
projectNext(number: $number) { projectV2(number: $number) {
id id
fields(first:20) { fields(first:20) {
nodes { nodes {
... on ProjectV2Field {
id id
name name
} }
@ -38,13 +39,13 @@ jobs:
} }
} }
} }
' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json }' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
# Parse project data # Parse project data
cat >> $GITHUB_ENV <<EOF cat >> $GITHUB_ENV <<EOF
PROJECT_ID=$(jq '.data.organization.projectNext.id' project_data.json) PROJECT_ID=$(jq '.data.organization.projectV2.id' project_data.json)
PLUGIN_FIELD_ID=$(jq '.data.organization.projectNext.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json) PLUGIN_FIELD_ID=$(jq '.data.organization.projectV2.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json)
THEME_FIELD_ID=$(jq '.data.organization.projectNext.fields.nodes[] | select(.name == "Theme") | .id' project_data.json) THEME_FIELD_ID=$(jq '.data.organization.projectV2.fields.nodes[] | select(.name == "Theme") | .id' project_data.json)
EOF EOF
- name: Add to project - name: Add to project
@ -53,13 +54,13 @@ jobs:
run: | run: |
item_id="$(gh api graphql -f query=' item_id="$(gh api graphql -f query='
mutation($project: ID!, $content: ID!) { mutation($project: ID!, $content: ID!) {
addProjectNextItem(input: {projectId: $project, contentId: $content}) { addProjectV2ItemById(input: {projectId: $project, contentId: $content}) {
projectNextItem { item {
id id
} }
} }
} }
' -f project=$PROJECT_ID -f content=$ISSUE_OR_PR_ID --jq '.data.addProjectNextItem.projectNextItem.id')" ' -f project=$PROJECT_ID -f content=$ISSUE_OR_PR_ID --jq '.data.addProjectV2ItemById.item.id')"
echo "ITEM_ID=$item_id" >> $GITHUB_ENV echo "ITEM_ID=$item_id" >> $GITHUB_ENV
@ -108,23 +109,23 @@ jobs:
$theme_field: ID! $theme_field: ID!
$theme_value: String! $theme_value: String!
) { ) {
set_plugin: updateProjectNextItemField(input: { set_plugin: updateProjectV2ItemFieldValue(input: {
projectId: $project projectId: $project
itemId: $item itemId: $item
fieldId: $plugin_field fieldId: $plugin_field
value: $plugin_value value: $plugin_value
}) { }) {
projectNextItem { projectV2Item {
id id
} }
} }
set_theme: updateProjectNextItemField(input: { set_theme: updateProjectV2ItemFieldValue(input: {
projectId: $project projectId: $project
itemId: $item itemId: $item
fieldId: $theme_field fieldId: $theme_field
value: $theme_value value: $theme_value
}) { }) {
projectNextItem { projectV2Item {
id id
} }
} }
@ -133,4 +134,3 @@ jobs:
-f plugin_field=$PLUGIN_FIELD_ID -f plugin_value=$PLUGIN \ -f plugin_field=$PLUGIN_FIELD_ID -f plugin_value=$PLUGIN \
-f theme_field=$THEME_FIELD_ID -f theme_value=$THEME \ -f theme_field=$THEME_FIELD_ID -f theme_value=$THEME \
--silent --silent