Files
Gitea-Tools/close_issue.sh
T
2026-06-21 15:35:57 -04:00

16 lines
496 B
Bash
Executable File

#!/usr/bin/env bash
HOST="gitea.dadeschools.net"
API="https://$HOST/api/v1"
ORG="Contractor"
REPO="Timesheet"
ISSUE_NUM=$1
CREDS=$(printf "host=%s\nprotocol=https\n\n" "$HOST" | git credential fill)
USER=$(printf '%s\n' "$CREDS" | sed -n 's/^username=//p')
PASS=$(printf '%s\n' "$CREDS" | sed -n 's/^password=//p')
AUTH=(-u "$USER:$PASS")
PAYLOAD='{"state": "closed"}'
curl -sSL -X PATCH "${AUTH[@]}" -H "Content-Type: application/json" -d "$PAYLOAD" "$API/repos/$ORG/$REPO/issues/$ISSUE_NUM"