dump expected issue contents even when issue doesn't yet exist

This commit is contained in:
Jacob Lifshay 2025-08-25 23:20:50 -07:00
parent fbdcceaea2
commit cc7aa3c7b1
Signed by: programmerjake
SSH key fingerprint: SHA256:HnFTLGpSm4Q4Fj502oCFisjZSoakwEuTsJJMSke63RQ

View file

@ -103,14 +103,22 @@ $subtask_body
body_middle="${example_body_middle%$'\n'}"
body+="${body_middle#$'\n'}"
body+="$body_suffix"
printf '\e]8;;%s\e\\Issue #%s\e]8;;\e\\: error: %s\nExample Issue:\nTitle: %s\nDescription:\n%s\n%s\n%s\n' \
printf '\n\n\e]8;;%s\e\\Issue #%s\e]8;;\e\\: error: %s\nExample Issue:\nTitle: %s\nDescription:\n%s\n%s\n%s\n' \
"$(issue_url "$issue_number")" "$issue_number" "$*" \
"$example_title" "$bar" "$body" "$bar" >&2
exit 1
}
issue_json="$(curl -sS "https://git.libre-chip.org/api/v1/repos/libre-chip/grant-tracking/issues/$issue_number" \
-H "Accept: application/json" \
-H "Authorization: token $FORGEJO_TOKEN")" || error "can't retrieve issue"
if [[ "$issue_number" =~ ^'N'?$ ]]; then
error "issue number must be set"
fi
[[ "$issue_number" =~ ^[0-9]+$ ]] || error "invalid issue number"
if [[ "$FORGEJO_TOKEN" ]]; then
issue_json="$(curl -sS "https://git.libre-chip.org/api/v1/repos/libre-chip/grant-tracking/issues/$issue_number" \
-H "Accept: application/json" \
-H "Authorization: token $FORGEJO_TOKEN")" || error "can't retrieve issue"
else
error "FORGEJO_TOKEN is not set, can't check issue (this is expected outside of CI)"
fi
issue_title="$(echo "$issue_json" | jq -r '.title')"
issue_body="$(echo "$issue_json" | jq -r '.body')"
[[ "$issue_title" =~ ^"NLnet $nlnet_id "(.*)$ ]] || error "title must start with \`NLnet $nlnet_id \`"
@ -231,7 +239,6 @@ function check_progress()
issue_number="${BASH_REMATCH[2]}"
issue_number2="${BASH_REMATCH[4]}"
subtask_title="${BASH_REMATCH[5]}"
[[ "$issue_number" != "N" ]] || [[ "$nlnet_id" = "YYYY-MM-ID" ]] || nonfatal_error "issue number must be set"
[[ ( "$issue_number" = "N" && -z "$issue_number2" ) || "$issue_number" = "$issue_number2" ]] || \
nonfatal_error "issue number in link name must match issue number in url"
((subtask_line_index = line_index))
@ -252,7 +259,7 @@ function check_progress()
subtask_body_trailing_lines=""
fi
done
if [[ "$issue_number2" =~ ^[0-9]+$ && "$nlnet_id" != "YYYY-MM-ID" && "$FORGEJO_TOKEN" ]]; then
if [[ "$nlnet_id" != "YYYY-MM-ID" ]]; then
check_issue "$issue_number2" "$nlnet_id" "$subtask_title" "$subtask_body" || diag "note:" -line_index="$subtask_line_index" "issue is linked from here"
fi
done