From 5c94814948ab6209ee74d225180b827d7f506f17 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Tue, 23 Jun 2026 15:30:34 +0200 Subject: [PATCH 1/2] Fix pr-comment poster never finding the artifact body MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `dawidd6/action-download-artifact` with a single `name:` extracts the artifact's contents into the workspace root, so `comment.md`, `header.txt` and `pr_number.txt` landed at `./` — not under `pr-comment/`. The metadata step's `[ -f pr-comment/comment.md ] || exit 0` therefore always bailed and no comment was ever posted. Add `path: pr-comment` to the download step so the files land where the rest of the workflow expects them. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/pr-comment.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml index 3738f55..b78ee8e 100644 --- a/.github/workflows/pr-comment.yml +++ b/.github/workflows/pr-comment.yml @@ -35,6 +35,10 @@ jobs: with: run_id: ${{ github.event.workflow_run.id }} name: pr-comment + # Extract into a pr-comment/ subdirectory; with a single named + # artifact this action otherwise unpacks the files into the workspace + # root, and the steps below look for them under pr-comment/. + path: pr-comment if_no_artifact_found: ignore - name: Read comment metadata From b6c8b588e67ec1a7d51ad23c95b2af7c6b2f191b Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Tue, 23 Jun 2026 15:47:28 +0200 Subject: [PATCH 2/2] Add debug logging to pr-comment metadata step Log the downloaded artifact contents and distinguish "no artifact" from "artifact present but no comment body" so a future path/artifact mismatch is visible in the run output rather than silently posting nothing. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/pr-comment.yml | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml index b78ee8e..8ff3b28 100644 --- a/.github/workflows/pr-comment.yml +++ b/.github/workflows/pr-comment.yml @@ -44,11 +44,29 @@ jobs: - name: Read comment metadata id: meta run: | - # No comment body means there is nothing to post. - [ -f pr-comment/comment.md ] || exit 0 + # Show what the download step actually produced. This makes a future + # path/artifact mismatch obvious instead of silently posting nothing. + echo "::group::Downloaded pr-comment contents" + ls -la pr-comment 2>/dev/null || echo "No pr-comment/ directory was downloaded." + echo "::endgroup::" + + # No artifact at all: the producer didn't upload one (e.g. a workflow + # that never builds a comment). Nothing to do. + if [ ! -d pr-comment ]; then + echo "No pr-comment artifact found; nothing to post." + exit 0 + fi + + # Artifact present but no body: a valid "nothing to report" outcome + # (e.g. linting passed, template up to date). + if [ ! -f pr-comment/comment.md ]; then + echo "Artifact present but no comment.md; nothing to post." + exit 0 + fi pr_number=$(cat pr-comment/pr_number.txt) header=$(cat pr-comment/header.txt) + echo "Found comment.md (header='$header', pr_number='$pr_number')." # Guard against anything unexpected ending up in the PR number. case "$pr_number" in @@ -61,6 +79,7 @@ jobs: echo "pr_number=$pr_number" >> "$GITHUB_OUTPUT" echo "header=$header" >> "$GITHUB_OUTPUT" echo "post=true" >> "$GITHUB_OUTPUT" + echo "Will post comment to PR #${pr_number}." - name: Post PR comment if: steps.meta.outputs.post == 'true'