From 4aa69aaf0b75529d8663bff2902e7e9e449cc827 Mon Sep 17 00:00:00 2001 From: Isaac Lins Date: Wed, 5 Aug 2026 09:43:17 +0200 Subject: [PATCH] fix: the preview reaper never read a pull request state gh api --include --silent prints the response headers and suppresses the body, so the file the reaper parsed held no JSON at all. jq found no .state, and the script exited 1 on the first preview it looked at. The daily cron would have failed every day. This was not caught because the only dry run happened while pr-preview/ did not exist, so the branch that talks to the API never executed. --- .github/workflows/pr-preview-reaper.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-preview-reaper.yml b/.github/workflows/pr-preview-reaper.yml index b96ddbb..436c97f 100644 --- a/.github/workflows/pr-preview-reaper.yml +++ b/.github/workflows/pr-preview-reaper.yml @@ -68,7 +68,10 @@ jobs: response_file="$(mktemp)" api_exit=0 - gh api --include --silent "repos/$REPOSITORY/pulls/$pr_number" >"$response_file" || api_exit=$? + # No --silent here. It suppresses the response body, which leaves the + # file holding headers only, so the state parse below finds nothing + # and every run dies on the first preview it inspects. + gh api --include "repos/$REPOSITORY/pulls/$pr_number" >"$response_file" || api_exit=$? status_code="$(awk '/^HTTP\/[^ ]+ / { code=$2 } END { print code }' "$response_file")" if (( api_exit == 0 )); then