Repository navigation
Publish bills on pull_request; GitHub now blocks pull_request_target - #248
Merged
Merged
Conversation
GitHub now blocks pull_request_target by default in public repositories without an Actions policy for it, so every Publish Bill run ended in startup_failure. The workflow runs on pull_request (closed, into main). A fork PR's run has no secrets, so a fork job fails with the command to publish by hand, and workflow_dispatch publishes a merged bill-review PR by number after checking it through the API. Also drops the stale comment on the removed migration 010 fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PavelMakarchuk
approved these changes
Dec 4, 2026
PavelMakarchuk
left a comment
Contributor
There was a problem hiding this comment.
Review at 346a7f7
This PR moves "Publish Bill on PR Merge" from pull_request_target to pull_request (closed, into main). GitHub now blocks pull_request_target by default in public repositories. A merged bill-review PR from a branch in this repository publishes as before. For a merged bill-review PR from a fork, a new fork job fails and prints the command to publish by hand. A new workflow_dispatch input publishes any merged bill-review PR by number. The PR also adds a read-only permissions block and removes the stale fallback comment from the #241 review.
Verdict: APPROVE
SUGGESTION
- .github/workflows/publish-bill.yml:44: two publish runs at the same time can deploy an older page set.
modal_app.pyrunsscripts/prerender.mjsat deploy time, and it reads Supabase. Example: bill A merges, and bill B merges one minute later. Run A starts its deploy before run B writespublished, but run A's deploy finishes last. The live pages then do not include bill B. This race existed before. The new manual input makes it more likely, because someone can publish several fork PRs one after the other. Fix: move the checkout andmodal deploysteps into a second job (needs: publish) withconcurrency: { group: publish-bill-deploy, cancel-in-progress: false }. Do not put the concurrency group on thepublishjob: GitHub keeps only one pending run per group, so a third run cancels the second run before it writes its Supabase row. A cancelled pending deploy is safe, because the newest deploy reads all published rows. - .github/workflows/publish-bill.yml:88: the check reads line by line.
printf '%s' "$REFORM_ID" | grep -Eq '^…$'passes when any one line matches. I ran the step with the branchbill/x+ newline +y, and it passed and wrote two lines to$GITHUB_OUTPUT. Git does not allow control characters in ref names, so a real branch cannot do this. The comment at line 52 says the check makes the value a plain id, so a whole-string check is better. Fix:[[ "$REFORM_ID" =~ ^[a-z0-9][a-z0-9-]*$ ]]. - PR description: the fork count. The description says that 22 of the last 60 bill-review PRs came from a fork.
gh pr list --label bill-review --state all -L 60gives 33 cross-repository PRs: 17 merged, 3 closed and 13 open (#68, #70, #93, #111, #117, #128, #130, #132, #149, #150, #160, #163, #170). The 13 open ones will need the manual run if they merge as they are. Fix: correct the number, or push those branches into this repository before they merge. - docs/APP_V3_BILL_CONTRACT.md:12–14: the contract says that the merge publishes the bill. For a fork PR, this is no longer true; someone must run the workflow by hand. Fix: add one sentence to the "Approved" row or to line 14, in this PR or in #249.
Security analysis
- The claim about GitHub is correct. The GitHub changelog of 2 November 2026 ("pull_request_target blocked by default December 2") says that GitHub blocks
pull_request_targetevents by default in public repositories, unless an Actions event policy allows them. Enforcement started on 2 December 2026. The run history agrees. The last tracker run that started was skipped on 2 December at 3:28pm EST. The five runs from 3 December, 4:11pm EST on, all ended instartup_failure. policyengine-api'spull_request_targetworkflow ended instartup_failurefrom 3 December, 4:41am EST on. - Secrets. GitHub passes no secrets (except a read-only
GITHUB_TOKEN) to apull_requestrun for a PR from a fork. A same-repository PR gets the secrets. So theforkjob (line 33) and the head-repository check onpublish(line 49) match what GitHub does. If the fork is deleted,head.repois null, so theforkjob runs andpublishis skipped. That is correct. - Which code runs. For a merged PR,
GITHUB_REFisrefs/heads/mainandGITHUB_SHAis the merge commit. So the workflow file that runs is the reviewed one onmain. The publish step is inline, and the checkout at line 144 isref: main. No step runs a script from the PR head. - New exposure. For a same-repository PR that closes without a merge,
pull_requestruns the PR's own copy of the workflow, with secrets. Both jobs skip, but an author could edit the conditions. Only a person with write access can push a branch here, and that person can already run any workflow with secrets through apushtrigger. So this adds no new path to the secrets. Fork PRs get no secrets in any case. - Trigger and filters.
types: [closed]andbranches: [main]filter on the base branch.publishruns on apull_requestevent only whenmerged == true, thebill-reviewlabel is present, and the head is in this repository. A manual run checksmerged,base.ref == "main"and the label through the API. The PR number must be digits, and all PR values reach the shell throughenv:. - Permissions.
contents: readandpull-requests: readare enough foractions/checkoutandgh api …/pulls/N. The job writes only to Supabase and Modal, through secrets. - Double publish. A manual run for a PR that already published writes the same
status,approved_atandreview_pr_urlagain. That is safe. - Publish never runs. A label added after the merge, a fork PR, or a failed run each leave the bill
in_review. Theforkjob makes the fork case visible, and the manual run fixes all three. A merge with no label shows only asskipped, as before. - Stale comment from the #241 review: fixed. Lines 107–108 now say "approved_at (the merge time) and the review PR". The text about the removed 010 fallback is gone.
What I checked
- The full diff and the full workflow at
346a7f7. The YAML parses, and the jobs and permissions are as described. actionlint is not installed here, so I did not run it. The author reports it clean. - I extracted the "Read the review PR" step and ran it locally with read-only API calls. Manual runs: #219 gives
hi-sb3125-hd1and #171 (fork) givesid-sb1450, each with its merge time. #215 (open), #239 (no label),1; echo pwned, an empty value and #99999 are refused (exit 1). Merge path:bill/ga-sb168givesga-sb168.bill/ga$(id),feature/xandbill/are refused. The newline case is suggestion 2. modal_app.py: the pre-render layer reads Supabase on each deploy (suggestion 1).- Sources: the GitHub changelog entry above; the GitHub Docs pages "Events that trigger workflows" (
pull_request,workflow_dispatch) and "Securely using pull_request_target";gh run listfor this workflow and for policyengine-api. - No other workflow in this repository uses
pull_requestwith secrets. The branch starts fromfe43e9cand merges cleanly withmain(53aaa7d). No CI checks run on this branch. The head was346a7f7at the start and at the end of this review.
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.
"Publish Bill on PR Merge" can no longer start. GitHub now blocks
pull_request_targetby default in public repositories that have no Actions policy for it. Since 3 December, every run has ended instartup_failurewith no jobs:bill-reviewlabel and the job would have been skipped);pull_request_targetworkflow, since 09:41 UTC that day.The next bill-review merge would not publish its bill. That includes #215 and the 2026 rehearsal bill that App v3 needs (p453).
What changes
Trigger. The workflow runs on
pull_request(closed, intomain) in place ofpull_request_target. A bill-review PR from a branch in this repository gets the secrets as before. Every bill-review PR since July has come from this repository: those by the pipeline, Max and Pavel.PRs from a fork. A
pull_requestrun for a fork PR gets no secrets, so it can't publish. A separateforkjob now fails for a merged bill-review PR from a fork and prints the command to publish it by hand, so the miss is visible instead of silent. 33 of the last 60 bill-review PRs came from a fork (17 merged, 3 closed, 13 still open: Bill review: Income Tax Reduction Act of 2026 (GA) #68, Bill review: Virginia HB979 Income Tax Reform (VA) #70, Bill review: MA H5007 - Income Tax Rate Reduction #93, Bill review: Enhanced Child and Dependent Care Credit Act (NY) #111, Bill review: Increase Top Marginal Income Tax Rate (CT) #117, Bill review: An Act Increasing And Expanding The Property Tax Credit (CT) #128, Bill review: SC H.4216 - Income Tax Reform (SC) #130, Bill review: Delaware HB274 - Expand Child and Dependent Care Credit #132, Bill review: High-Earner Income Tax Surcharge (RI) #149, Bill review: Eliminates the individual income tax (MO) #150, Bill review: Child Tax Credit (MI) #160, Bill review: NY S9110 Personal Income Tax Rate Reform (NY) #163 and Bill review: GA HB463 - Georgia Economic Growth and Tax Relief Act of 2026 #170). Each open one needs the manual run if it merges as it is. (Corrected after review; this said 22.)Publishing by hand.
workflow_dispatchtakes a PR number:main.approved_atis the merge time andreview_pr_urlis the PR.Permissions. The workflow now declares
contents: readandpull-requests: read. It writes only to Supabase and Modal, through its secrets.Comment. The comment above the publish step no longer describes the removed migration 010 fallback (Pavel's suggestion 3 on Define the fields App v3 reads for a 2027 bill report #241).
The branch name still reaches the shell and Python only through
env:, and it must match^[a-z0-9][a-z0-9-]*$, as #241 set up. The PR number on a manual run must be digits.The other option
An org admin could add an Actions policy that allows
pull_request_targetfor.github/workflows/publish-bill.ymlonly. That would keep fork PRs publishing on merge. I can't see or change Actions policies (the API returns 403), and this PR works without one.Tests
actionlinton the workflow: clean.hi-sb3125-hd1andid-sb1450with their merge times;1; echo pwnedis refused;bill/ga-sb168givesga-sb168, andbill/ga$(id)is refused.skipped(nobill-reviewlabel), notstartup_failure.🤖 Generated with Claude Code