forked from Qortal/q-blog
20 lines
879 B
Bash
Executable File
20 lines
879 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
# Env: GITEA_BASE_URL, GITEA_TOKEN, OWNER, REPO
|
|
|
|
need() {
|
|
for v in GITEA_BASE_URL GITEA_TOKEN OWNER REPO; do
|
|
if [[ -z "${!v:-}" ]]; then echo "ERROR: Missing $v" >&2; exit 1; fi
|
|
done
|
|
}
|
|
|
|
main() {
|
|
need
|
|
MS_ID=$(curl -sS -H "Authorization: token ${GITEA_TOKEN}" "$GITEA_BASE_URL/api/v1/repos/$OWNER/$REPO/milestones" | jq -r '.[] | select(.title=="Patch 0 — Orientation & Quality Bar") | .id' | head -n1)
|
|
if [[ -z "$MS_ID" ]]; then echo "No Patch 0 milestone found"; exit 0; fi
|
|
echo "Renaming milestone id=$MS_ID to Phase 0 — Orientation & Quality Bar"
|
|
curl -sS -X PATCH -H "Authorization: token ${GITEA_TOKEN}" -H "Content-Type: application/json" "$GITEA_BASE_URL/api/v1/repos/$OWNER/$REPO/milestones/$MS_ID" --data '{"title":"Phase 0 — Orientation & Quality Bar"}' >/dev/null
|
|
echo "Done."
|
|
}
|
|
main "$@"
|