feature: pr-number / pr-url outputs - #44
Merged
Merged
Conversation
Expose the PR this run created or edited as new `pr-number`/`pr-url` outputs - empty in dry-run, when nothing was pushed, or on a failure before the PR step. Both are computed once in run() from a single construction (server_url/repository + the resolved PR number) shared by the create and edit paths, and by the create-issues feature's own issue bodies (no second way of computing the URL). An unparsable `gh pr create` output falls back to empty outputs with a ::warning:: rather than failing the run. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Extends the existing "Assert reported outputs (basic scenario)" e2e step rather than adding a new job/matrix entry. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…nd workflow Now that the action exposes pr-url, step 9's auto-merge becomes one extra step in the same job (gated on steps.update.outputs.pr-url != '') instead of a separate, pull_request-triggered workflow keyed on the branch name. Step 10's recap collapses to the single resulting workflow file. Drops the now-inapplicable fork paragraph, keeps the "Allow auto-merge" + required-status-check note, and explains in one sentence why the PAT is still required. Also switches this repo's own update_dependencies.yml to the same auto-merge step, using its existing DEPS_UPDATE_TOKEN-or-github.token fallback. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Adds push_ok to FakeGit and create_ok/edit_ok to FakeGithubPR, plus tests (driven through main(), not just run()) proving a git push failure, a gh pr create failure, and a gh pr edit failure all: leave pr-number/pr-url empty, still write the rest of the outputs, and exit main() with code 1. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Covers: URL-only stdout, a leading line before the URL, a GitHub Enterprise Server host, and no URL at all (-> None). The old docstring claimed the URL is always the only stdout line; softened to say what the function actually does (scans the whole output). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A PR opened with the default GITHUB_TOKEN does trigger pull_request workflow runs - GitHub holds them in an approval-required state instead of starting them (see https://docs.github.com/en/actions/concepts/security/github_token), not "never triggers" them as the docs previously claimed. Fixes the wording in README.md, docs/manual/token-and-permissions.md, and docs/tutorials/weekly-updates.md (step 3's intro and comment, and step 9's PAT note). Also: rewrites tutorial step 9's intro (was a run-on sentence), shortens the new step's arrow comments so none overlap in wording, and turns its two trailing prose paragraphs into a short "Needs:" list. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pr-number/pr-urloutputs: set when this run created or edited the PR, empty indry-run, when nothing was pushed, or on a failure before the PR step.run()from a single construction (server_url/repository+ the resolved PR number), shared by the create and edit paths, and reused as-is forcreate-issues' own issue bodies (no second way of computing the URL). Ifgh pr create's stdout can't be parsed, the run prints a::warning::and leaves both outputs empty rather than failing.action.yml(+ descriptions pointing atdocs/manual/outputs.md),docs/manual/outputs.md(table row + a 5-line "use it" example), and one sentence indocs/manual/how-it-works.md.if: steps.update.outputs.pr-url != '') instead of a second,pull_request-triggered workflow keyed on the branch name. Step 10's recap collapses to a single workflow file. Drops the now-inapplicable fork paragraph, keeps the "Allow auto-merge" + required-status-check note (now a short "Needs:" list), and adds one sentence on why the PAT is still needed..github/workflows/update_dependencies.ymlto use the same auto-merge step (with its existingDEPS_UPDATE_TOKEN || github.tokenfallback).pr-number/pr-urlare present and empty in dry-run.Review-fix round
FakeGitgainedpush_ok,FakeGithubPRgainedcreate_ok/edit_ok. New tests drivemain()itself (not justrun()) and prove agit pushfailure, agh pr createfailure, and agh pr editfailure all leavepr-number/pr-urlempty, still write every other output, and exitmain()with code 1.GITHUB_TOKENwording was factually wrong. Per GitHub's docs, a PR opened with the defaultGITHUB_TOKENdoes triggerpull_requestworkflow runs - GitHub holds them in an approval-required state instead of starting them; someone with write access has to click "Approve workflows to run". The docs previously said these runs are "never triggered" at all, which is wrong (and understates how they can silently sit waiting). Corrected in:README.md,docs/manual/token-and-permissions.md,docs/tutorials/weekly-updates.md(step 3's intro + inline comment, step 9's PAT note).parse_created_pr_number: added direct unit tests (URL-only, a leading line before the URL, a GitHub Enterprise Server host, no URL ->None) and softened its docstring, which overclaimed the URL is always the only stdout line.tests/unit/test_tutorial_arrows.py's stale module docstring/assert message (referred to "two workflow lineages", no longer true) corrected - no test logic changed.Closes #43
Verified
uv run pytest tests/unit- 616 passed.uv run ruff check ./uv run ruff format --check .- clean.actionlint(from repo root, and directly against.github/workflows/*.yml) - clean.python3 .github/scripts/lint_docs_workflows.py(renders + actionlints every complete workflow example, uv and Poetry renditions) - clean.dry-runagainst a throwaway copy oftests/fixture/uv(uv run --no-project --python 3.14 -m updater, same invocation asaction.yml): confirmedpr-number=andpr-url=both written empty inGITHUB_OUTPUT.GITHUB_TOKENapproval-required behavior against GitHub's own current docs rather than from memory.Not verified (can't be exercised without a real GitHub repo/token): the actual
gh pr create/gh pr editcreate and edit paths against a real repo, and the live auto-merge step. These are covered by unit tests (tests/unit/test_run.py,tests/unit/test_github_pr.py) usingFakeGithubPR/FakeGitand, for the failure paths,main()itself with every real collaborator monkeypatched out.Deviations
action_requiredfor the held-run state; GitHub's own docs page actually calls it approval-required (verified viacurl/WebFetch against the live page) - used the accurate term instead.pr-number/pr-urlinaction.yml/outputs.mdright beforepr-body(logical PR-fields grouping) rather than at the end.🤖 Generated with Claude Code