Skip to content

Commit 6113733

Browse files
committed
ci: keep persistent tracker issues open
Related to #19
1 parent 8946f79 commit 6113733

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/pr-metadata.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
if (trackers.size) {
108108
const marker = '<!-- techapi-tracking -->';
109109
const existing = pr.body || '';
110-
const refs = [...trackers].sort().map((ref) => `- Refs ${ref}`).join('\n');
110+
const refs = [...trackers].sort().map((ref) => `- Related to ${ref}`).join('\n');
111111
const block = `${marker}\n\n## Tracking\n${refs}`;
112112
const body = existing.includes(marker)
113113
? existing.replace(new RegExp(`${marker}[\\s\\S]*$`), block)
@@ -160,6 +160,11 @@ jobs:
160160
project_json="$(gh project view "$project_number" --owner "$owner" --format json)"
161161
project_id="$(jq -r '.id' <<< "$project_json")"
162162
item_id="$(gh project item-add "$project_number" --owner "$owner" --url "$PR_URL" --format json --jq '.id')"
163+
status_field_id="$(gh project field-list "$project_number" --owner "$owner" --format json --jq '.fields[] | select(.name == "Status") | .id')"
164+
status_option_id="$(gh project field-list "$project_number" --owner "$owner" --format json --jq '.fields[] | select(.name == "Status") | .options[] | select(.name == "In Progress") | .id')"
165+
if [ -z "$status_option_id" ]; then
166+
status_option_id="$(gh project field-list "$project_number" --owner "$owner" --format json --jq '.fields[] | select(.name == "Status") | .options[] | select(.name == "Todo") | .id')"
167+
fi
163168
start_field_id="$(gh project field-list "$project_number" --owner "$owner" --format json --jq '.fields[] | select(.name == "Start date") | .id')"
164169
target_field_id="$(gh project field-list "$project_number" --owner "$owner" --format json --jq '.fields[] | select(.name == "Target date") | .id')"
165170
priority_field_id="$(gh project field-list "$project_number" --owner "$owner" --format json --jq '.fields[] | select(.name == "Priority") | .id')"
@@ -168,6 +173,9 @@ jobs:
168173
priority_option_id="$(gh project field-list "$project_number" --owner "$owner" --format json --jq '.fields[] | select(.name == "Priority") | .options[] | select(.name == "Medium") | .id')"
169174
fi
170175
176+
if [ -n "$item_id" ] && [ -n "$status_field_id" ] && [ -n "$status_option_id" ]; then
177+
gh project item-edit --id "$item_id" --project-id "$project_id" --field-id "$status_field_id" --single-select-option-id "$status_option_id"
178+
fi
171179
if [ -n "$item_id" ] && [ -n "$start_field_id" ]; then
172180
gh project item-edit --id "$item_id" --project-id "$project_id" --field-id "$start_field_id" --date "$today"
173181
fi

0 commit comments

Comments
 (0)