@@ -48,20 +48,8 @@ milestone_pr_ids=()
48
48
49
49
# # Function definitions
50
50
51
- function get_field_ids_from_github_beta_project() {
52
- if [ " $1 " == " project-id" ]
53
- then
54
- query=' .data.organization.projectV2.id'
55
- elif [ " $1 " == " type-id" ]
56
- then
57
- query=' .data.organization.projectV2.fields.nodes[] | select(.name== "Type") | .id'
58
- elif [ " $1 " == " issue-id" ]
59
- then
60
- query=' .data.organization.projectV2.fields.nodes[] | select(.name== "Type") | .options[] | select(.name== "Issue") | .id'
61
- # for "pr-id"
62
- else
63
- query=' .data.organization.projectV2.fields.nodes[] | select(.name== "Type") | .options[] | select(.name== "PR") | .id'
64
- fi
51
+ function get_project_id_from_github_beta_project() {
52
+ query=' .data.organization.projectV2.id'
65
53
66
54
ID=" $( gh api graphql -f query='
67
55
query($org: String!, $number: Int!) {
@@ -91,30 +79,6 @@ function get_field_ids_from_github_beta_project() {
91
79
}
92
80
93
81
94
- function add_items_to_github_beta_project {
95
- gh api graphql -f query='
96
- mutation (
97
- $project: ID!
98
- $item: ID!
99
- $type_field: ID!
100
- $option_id: String!
101
- ) {
102
- set_issue_type: updateProjectV2ItemFieldValue(input: {
103
- projectId: $project
104
- itemId: $item
105
- fieldId: $type_field
106
- value: {
107
- singleSelectOptionId: $option_id
108
- }
109
- }) {
110
- projectV2Item {
111
- id
112
- }
113
- }
114
- }' -f project=" ${PROJECT_ID} " -f item=" ${1} " -f type_field=" ${TYPE_FIELD_ID} " -f option_id=" ${2} " --silent
115
- }
116
-
117
-
118
82
echo ' Starting sync...'
119
83
echo -e " [INFO] Fetching the list of open issues and PRs from k/k under the current release milestone, ${MILESTONE} "
120
84
@@ -191,10 +155,7 @@ done
191
155
# # Fetch Project metadata
192
156
echo -e " [INFO] Getting metadata for the Bug Triage GitHub Beta Project with ID: ${PROJECT_NUMBER} "
193
157
194
- PROJECT_ID=$( get_field_ids_from_github_beta_project " project-id" )
195
- TYPE_FIELD_ID=$( get_field_ids_from_github_beta_project " type-id" )
196
- ISSUE_OPTION_ID=$( get_field_ids_from_github_beta_project " issue-id" )
197
- PR_OPTION_ID=$( get_field_ids_from_github_beta_project " pr-id" )
158
+ PROJECT_ID=$( get_project_id_from_github_beta_project)
198
159
199
160
200
161
# # Add data to the Project Board
212
173
}
213
174
}
214
175
}' -f project=" ${PROJECT_ID} " -f issue=" ${issue_id} " --jq ' .data.addProjectV2ItemById.item.id' ) "
215
-
216
- add_items_to_github_beta_project " ${item_id} " " ${ISSUE_OPTION_ID} "
217
176
fi
218
177
done
219
178
231
190
}
232
191
}
233
192
}' -f project=" ${PROJECT_ID} " -f pr=" ${pr_id} " --jq ' .data.addProjectV2ItemById.item.id' ) "
234
-
235
- add_items_to_github_beta_project " ${item_id} " " ${PR_OPTION_ID} "
236
193
fi
237
194
done
238
195
0 commit comments