Comment the fixing commit when a check issue closes.
This commit is contained in:
@@ -28,6 +28,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
API_BASE: ${{ github.server_url }}/api/v1
|
API_BASE: ${{ github.server_url }}/api/v1
|
||||||
REPO: ${{ github.repository }}
|
REPO: ${{ github.repository }}
|
||||||
|
SHA: ${{ github.sha }}
|
||||||
# Prefer a PAT with issue write scope (secret: GITEA_TOKEN).
|
# Prefer a PAT with issue write scope (secret: GITEA_TOKEN).
|
||||||
# Default GITHUB_TOKEN is usually scoped to this repo only.
|
# Default GITHUB_TOKEN is usually scoped to this repo only.
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ set -u
|
|||||||
API_BASE="${API_BASE:?API_BASE is required}"
|
API_BASE="${API_BASE:?API_BASE is required}"
|
||||||
REPO="${REPO:?REPO is required}"
|
REPO="${REPO:?REPO is required}"
|
||||||
TOKEN="${TOKEN:?TOKEN is required}"
|
TOKEN="${TOKEN:?TOKEN is required}"
|
||||||
|
SHA="${SHA:-}"
|
||||||
|
BASE="${API_BASE%/api/v1}"
|
||||||
LABEL="ci-checks"
|
LABEL="ci-checks"
|
||||||
SHOW="${SHOW:-50}"
|
SHOW="${SHOW:-50}"
|
||||||
|
|
||||||
@@ -78,6 +80,9 @@ jq -r '[((.body // "") | capture("<!-- ci-check: (?<k>[^ ]+) -->").k), .number]
|
|||||||
|
|
||||||
while IFS=$'\t' read -r key number; do
|
while IFS=$'\t' read -r key number; do
|
||||||
if ! grep -qF -- "$key"$'\t' "$FINDINGS"; then
|
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
|
api PATCH "/issues/$number" '{"state": "closed"}' > /dev/null
|
||||||
fi
|
fi
|
||||||
done < "$WORK/keys.tsv"
|
done < "$WORK/keys.tsv"
|
||||||
|
|||||||
Reference in New Issue
Block a user