From 05bc65b183dad88832dd609f583c73ef5214a022 Mon Sep 17 00:00:00 2001 From: Radoslav Dimitrov Date: Tue, 21 Apr 2026 23:37:04 +0300 Subject: [PATCH] Fix retry-mode git context + push refresh commit immediately MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two bugs from the first real Renovate run (#759) and its retry: 1. workflow_dispatch retry failed at "Resolve PR number and head ref" with "failed to run git: fatal: not a git repository". The step runs BEFORE actions/checkout, so `gh pr view` has no git context to infer the repo from. Added `--repo "$GITHUB_REPOSITORY"` to the three gh pr view calls that run pre-checkout (HEAD_REF + AUTHOR in the retry branch of step "pr", plus BASE in the retry branch of step "eff"). The error message we initially saw ("author ... is not an accepted bot") was just the shell source being echoed by `bash -x`-like output; the actual runtime never got to that point. 2. The refresh commit (~38 files, reference-asset regeneration) was only pushed at the END of the workflow, after the skill. When the skill failed or was cancelled — which it did repeatedly today — the refresh commit died with the runner and PRs ended up with only the one-line YAML bump. Now push the refresh commit as soon as it's created, so the reference-asset work lands on the PR branch independent of skill outcome. This was a pending commit that got orphaned by #760's squash-merge; re-shipping. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/upstream-release-docs.yml | 23 ++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/upstream-release-docs.yml b/.github/workflows/upstream-release-docs.yml index 5a2bf282..c456ab6e 100644 --- a/.github/workflows/upstream-release-docs.yml +++ b/.github/workflows/upstream-release-docs.yml @@ -111,8 +111,11 @@ jobs: workflow_dispatch) if [ -n "$DISPATCH_PR" ]; then PR_NUMBER="$DISPATCH_PR" - HEAD_REF=$(gh pr view "$PR_NUMBER" --json headRefName --jq .headRefName) - AUTHOR=$(gh pr view "$PR_NUMBER" --json author --jq '.author.login') + # --repo is required because this step runs before the + # actions/checkout below — gh otherwise looks for a + # local .git context and fails with "not a git repository". + HEAD_REF=$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json headRefName --jq .headRefName) + AUTHOR=$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json author --jq '.author.login') case "$AUTHOR" in app/renovate|renovate[bot]|app/github-actions|github-actions[bot]) ;; @@ -235,9 +238,10 @@ jobs: BASE="$BASE_FROM_EVENT" else # workflow_dispatch retry: look up the PR's base_ref. + # --repo because in retry mode there's no prior checkout. NUMBER="$PR_FROM_RESOLVE" HEAD="$HEAD_FROM_RESOLVE" - BASE=$(gh pr view "$NUMBER" --json baseRefName --jq .baseRefName) + BASE=$(gh pr view "$NUMBER" --repo "$GITHUB_REPOSITORY" --json baseRefName --jq .baseRefName) fi { echo "number=$NUMBER" @@ -344,21 +348,26 @@ jobs: node scripts/bundle-upstream-schema.mjs rm -rf "$TMP" - # Commit the refreshed reference assets (synced release-asset - # files + regenerated toolhive CRD MDX if applicable) before the - # skill runs. This keeps the skill's content commit clean and + # Commit AND PUSH the refreshed reference assets (synced release- + # asset files + regenerated toolhive CRD MDX if applicable) before + # the skill runs. Pushing here — rather than batching the push + # with the skill-content commit later — means refresh work is + # preserved on the PR even if the skill step fails or is + # cancelled. Also keeps the skill's content commit clean and # lets the autogen-detect step below distinguish skill touches # from our own legitimate refresh writes. - - name: Commit refreshed reference assets + - name: Commit + push refreshed reference assets env: PROJECT_ID: ${{ steps.detect.outputs.id }} NEW_TAG: ${{ steps.detect.outputs.new_tag }} + HEAD_REF: ${{ steps.eff.outputs.head_ref }} run: | git add -A if git diff --cached --quiet; then echo "No reference changes for $PROJECT_ID $NEW_TAG." else git commit -m "Refresh reference assets for $PROJECT_ID $NEW_TAG" + git push origin "HEAD:$HEAD_REF" fi - name: Extract reviewers from release compare