Repository navigation
Add reusable PR approved issue check workflow - #13
Merged
Merged
Conversation
jeffcarp
force-pushed
the
add-pr-approved-issue
branch
from
September 24, 2026 18:32
6db8e7c to
c7d3f66
Compare
…docs/pr_policy.md
…rt to draft, and post comment on failure
Member
Author
|
Ok I overhauled this entire PR to fix some edge cases and remove some behavior (like automatically returning PRs from draft to non-draft (this is unexpected behavior) and mutating the PR description to help users who deleted it from the template (that's their problem)). I also added canonical documentation about the PR policy in |
SamanehSaadat
approved these changes
Sep 24, 2026
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.
Extracts
pr-approved-issue.ymlandscripts/pr-approved-issue.jsfromkeras-hubintokeras-team/shared-workflows, adds unit tests inscripts/pr-approved-issue.test.js, and addsdocs/pr_policy.md.Summary of Changes
Reusable Workflow (
.github/workflows/pr-approved-issue.yml)refinput (default'main') to check outkeras-team/shared-workflowsat a pinned SHA/ref.Botaccounts andOWNER/MEMBER/COLLABORATORassociations at the jobif:level.Policy Documentation (
docs/pr_policy.md)cross-referencedtimeline event onkeras-team/keras#23601.First-Principles Improvements in
scripts/pr-approved-issue.jsgithub.rest.pulls.get: Fetches the live PR description and draft status from the GitHub API rather than reading the frozen webhookcontext.payload.pull_requestsnapshot, so re-running a failed workflow job after fixing the issue/PR picks up the latest state.SECTION_TEMPLATEandgithub.rest.pulls.updateso the action never overwrites the PR body or triggers extraeditedwebhook runs.markReadyForReview): RemovedmarkReadyForReviewand the unconditional convert-to-draft onopened. The script now validates issue references first and only converts non-draft PRs to draft (convertToDraft) when the check fails. Draft PRs remain in draft until the author marks them ready.upsertCommentpagination/updating. When the check passes, it logs viacore.infoand exits cleanly without commenting. When the check fails, it converts non-draft PRs to draft, posts a comment viacreateComment(onopenedor when converting a non-draft PR to draft), and fails the check viacore.setFailed.<!-- ... -->) before scanning: PreventsfindIssueNumbersfrom matching placeholder issue numbers (such as<!-- Fixes #123 -->) inside HTML comments.keras-team/keras#23601: Explicitly ignores issue#23601inkeras-team/kerasso PRs created with the legacy template link are not treated as linking issue#23601.[bot]login suffixes (author.toLowerCase().endsWith("[bot]")) in addition totype === "Bot"and usescore.infoinstead ofconsole.log.Unit Tests (
scripts/pr-approved-issue.test.js)node:testsuite covering non-PR payloads, bypassed roles/bots, live PR fetch viapulls.geton re-runs, draft conversion and commenting on failure, clean pass without draft/comment mutation, HTML comment 就filtering, cross-repo & PR number filtering, and GraphQL error handling.Closes #9