diff --git a/.github/workflows/js-autofix.yml b/.github/workflows/js-autofix.yml index f362f3c27..ae6caab0f 100644 --- a/.github/workflows/js-autofix.yml +++ b/.github/workflows/js-autofix.yml @@ -168,11 +168,13 @@ jobs: # force-push above already updated it with the latest fixes. PR_NUM=$(gh pr list --head "$BOT_BRANCH" --state open --json number --jq '.[0].number' 2>/dev/null || true) if [ -z "$PR_NUM" ]; then - PR_NUM=$(gh pr create \ + # gh pr create prints the PR URL. Extract the number from it + # (https://github.com///pull/). + PR_URL=$(gh pr create \ --head "$BOT_BRANCH" --base main \ --title 'fmt(js): `npm run fix` auto-fix' \ - --body 'Auto-generated by the `auto-fix lint issues & formatting` workflow. Auto-merges (squash) once CI passes. If CI fails or `main` moves, the PR is auto-closed and the branch deleted — the next run re-applies on the current state.' \ - --json number --jq '.number') + --body 'Auto-generated by the `auto-fix lint issues & formatting` workflow. Auto-merges (squash) once CI passes. If CI fails or `main` moves, the PR is auto-closed and the branch deleted — the next run re-applies on the current state.') + PR_NUM=$(echo "$PR_URL" | grep -oE '[0-9]+$') fi # Enable auto-merge (squash). If already enabled, this is a no-op.