#!/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"