diff --git a/.gitea/workflows/checks.yml b/.gitea/workflows/checks.yml index ccd2e1a0..46f7e33c 100644 --- a/.gitea/workflows/checks.yml +++ b/.gitea/workflows/checks.yml @@ -28,6 +28,7 @@ jobs: env: API_BASE: ${{ github.server_url }}/api/v1 REPO: ${{ github.repository }} + SHA: ${{ github.sha }} # Prefer a PAT with issue write scope (secret: GITEA_TOKEN). # Default GITHUB_TOKEN is usually scoped to this repo only. GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} diff --git a/scripts/ci-checks.sh b/scripts/ci-checks.sh index e583c856..073aa0fe 100644 --- a/scripts/ci-checks.sh +++ b/scripts/ci-checks.sh @@ -6,6 +6,8 @@ set -u API_BASE="${API_BASE:?API_BASE is required}" REPO="${REPO:?REPO is required}" TOKEN="${TOKEN:?TOKEN is required}" +SHA="${SHA:-}" +BASE="${API_BASE%/api/v1}" LABEL="ci-checks" SHOW="${SHOW:-50}" @@ -78,6 +80,9 @@ jq -r '[((.body // "") | capture("").k), .number] while IFS=$'\t' read -r key number; do if ! grep -qF -- "$key"$'\t' "$FINDINGS"; then + if [ -n "$SHA" ]; then + api POST "/issues/$number/comments" "$(jq -n --arg b "Fixed in [$(printf '%s' "$SHA" | cut -c1-7)]($BASE/commit/$SHA)." '{body: $b}')" > /dev/null + fi api PATCH "/issues/$number" '{"state": "closed"}' > /dev/null fi done < "$WORK/keys.tsv"