Fail closed for draft PR gate skips - #48
Conversation
AAH20
left a comment
There was a problem hiding this comment.
Solid fix. The current main sets approved=true for draft PRs and exits before calling /api/v1/receipts/verify, so a required status check can stay green on the same head SHA after ready_for_review — exactly the gap described in #45.
Code observations:
-
ready_for_reviewtrigger addition — correct and necessary. Without it the defaultpull_requesttrigger types (opened,synchronize,reopened) never refire the check when a draft PR is marked ready, so the skip result persists. -
PP_ALLOW_DRAFT_SKIPopt-in — good UX; repos that legitimately want the old behavior can setallow-draft-skip: true, and the::warningnudges them to keepready_for_reviewin the trigger list. -
All outputs are set on both paths — the
DRAFT_BLOCKEDbranch correctly sets every output (approved,receipt-id,decision,error-code,error-message,request-id,approval-url) beforeexit 1, matching the pattern used by every other failure branch. No downstream step can hit an undefined output. -
Minor:
::errorguidance message could mention theallow-draft-skip: trueescape hatch explicitly, so the first thing a user sees in CI is both the why and the how-to-opt-out. Not blocking — the INSTALL.md section covers it.
Approving as-is. Nice contribution.
Summary
approved=truewithout receipt verificationallow-draft-skip: trueas an explicit opt-in for repos that still want the previous skip behaviorpull_requesttriggers to includeready_for_reviewWhy
Fixes #45.
Related to #36.
The previous draft skip path exited
0before calling/api/v1/receipts/verify. With the documented/defaultpull_requesttrigger, GitHub does not rerun onready_for_review, so a required check could stay green on the same head SHA without any receipt ever being created or verified.Validation
ruby -ryaml -e 'YAML.load_file("action.yml"); puts "action.yml ok"'bash -ngit diff --checkallow-draft-skip=falseexits1withPP_DRAFT_PR_BLOCKEDallow-draft-skip=truepreservesDRAFT_SKIPPEDwith a warning