Skip to content

feat(hook): deny asking gh whether a pull request can merge - #156

Merged
CybotTM merged 2 commits into
mainfrom
feat/warn-on-handrolled-merge-readiness
Aug 8, 2026
Merged

feat(hook): deny asking gh whether a pull request can merge#156
CybotTM merged 2 commits into
mainfrom
feat/warn-on-handrolled-merge-readiness

Conversation

@CybotTM

@CybotTM CybotTM commented Aug 8, 2026

Copy link
Copy Markdown
Member

The skill already documents pr-status.sh as the status tool for the wait/merge cycle, and the hook already gates the hand-rolled poll. The single-shot query was not gated: gh pr view --json mergeStateStatus and gh api .../pulls/N --jq .mergeable_state answer "blocked" and never say why, staying blind to the two states that usually cause it — an unresolved review thread and a failing check.

Documenting it did not hold. In one session I issued 24 such queries despite the rule being in my own instructions, and told the operator a pull request was "waiting for your approval" while two CodeQL review threads and two red CI jobs sat unattended. They had to point it out. That is what this gate is for.

Scope is deliberately narrow. Only a segment that actually invokes gh counts, and shell keywords are skipped so a loop body ( do gh api ... after splitting on separators) is caught as well — that was the exact shape I kept using. Writing about the rule stays possible: a heredoc carrying test cases, an echo, a grep pattern, this rule's own tests. Commands that already run pr-status.sh pass, and so does the GraphQL query carrying isRequired — that one names which required context is unmet, which pr-status.sh does not break down, so it is a deliberate deep dive rather than a status check.

scripts/validate_git_command.py had no tests at all. It has them now — standard library only, no dependency to install — covering the new gate in both directions plus the conventional-commit, force-push and hard-reset checks that were already there, and a CI job runs them. A PreToolUse hook decides whether commands run in every session that installs this plugin, so a silent regression there is expensive.

Copilot AI lite review requested due to automatic review settings August 8, 2026 08:30
@github-actions github-actions Bot added the ci label Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/checkout 3d3c42e5aac5ba805825da76410c181273ba90b1 🟢 6.9
Details
CheckScoreReason
Binary-Artifacts🟢 10no binaries found in the repo
Code-Review🟢 10all changesets reviewed
Maintained🟢 1024 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Fuzzing⚠️ 0project is not fuzzed
Packaging⚠️ -1packaging workflow not detected
License🟢 10license file detected
Pinned-Dependencies🟢 3dependency not pinned by hash detected -- score normalized to 3
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
SAST🟢 10SAST tool is run on all commits
Branch-Protection🟢 5branch protection is not maximal on development and all release branches
actions/step-security/harden-runner b09bb98e06d4d774595224525879c09bc6e98c40 🟢 7.9
Details
CheckScoreReason
Binary-Artifacts🟢 10no binaries found in the repo
Branch-Protection🟢 8branch protection is not maximal on development and all release branches
CI-Tests🟢 106 out of 6 merged PRs checked by a CI test -- score normalized to 10
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Code-Review🟢 10all changesets reviewed
Contributors🟢 6project has 2 contributing companies or organizations -- score normalized to 6
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Dependency-Update-Tool🟢 10update tool detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Maintained🟢 1028 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 10
Packaging⚠️ -1packaging workflow not detected
Pinned-Dependencies🟢 6dependency not pinned by hash detected -- score normalized to 6
SAST🟢 10SAST tool is run on all commits
Security-Policy🟢 10security policy file detected
Signed-Releases⚠️ -1no releases found
Token-Permissions🟢 10GitHub workflow tokens follow principle of least privilege
Vulnerabilities⚠️ 022 existing vulnerabilities detected

Scanned Files

  • .github/workflows/hook-tests.yml

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CybotTM
CybotTM requested a lite review from Copilot August 8, 2026 08:31
@CybotTM
CybotTM requested a lite review from Copilot August 8, 2026 08:32
@CybotTM
CybotTM force-pushed the feat/warn-on-handrolled-merge-readiness branch from ddfd4f8 to 48b50e0 Compare August 8, 2026 08:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CybotTM
CybotTM requested a lite review from Copilot August 8, 2026 08:34
@CybotTM
CybotTM force-pushed the feat/warn-on-handrolled-merge-readiness branch from 48b50e0 to f79926e Compare August 8, 2026 08:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

CybotTM added 2 commits August 8, 2026 10:38
`gh pr view --json mergeStateStatus` and `gh api .../pulls/N --jq
.mergeable_state` answer "blocked" and never say why. They are blind to
the two states that usually cause it — an unresolved review thread and a
failing check — so a pull request that needs work looks like one that is
merely waiting. pr-status.sh reports both and ends with a NEXT: line
naming the action, which is why the skill documents it as the status tool
for the wait/merge cycle.

Documenting it was not enough: one session issued 24 such queries despite
the rule, and reported "waiting for your approval" while two review
threads and two red CI jobs sat unattended. This gates the shape the same
way the hand-rolled poll above it is gated.

Only a segment that actually invokes gh counts, and shell keywords are
skipped so a loop body — " do gh api ..." after splitting on separators —
is caught too. Writing about the rule stays possible: a heredoc carrying
test cases, an echo, a grep pattern. Commands already running
pr-status.sh pass, as does the GraphQL query with `isRequired`, which
names which required context is unmet and is the one thing pr-status.sh
does not break down.

The script had no tests. It has them now, standard library only, covering
the new gate in both directions and the checks that were already here.

Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
lint.yml is governed by the skill template and has to stay byte-identical
across skill repos, so the job gets its own workflow rather than an
exception on a governed file.

Signed-off-by: Sebastian Mendel <github@sebastianmendel.de>
@CybotTM
CybotTM requested a lite review from Copilot August 8, 2026 08:38
@CybotTM
CybotTM force-pushed the feat/warn-on-handrolled-merge-readiness branch from f79926e to 2eeb8da Compare August 8, 2026 08:38
@sonarqubecloud

sonarqubecloud Bot commented Aug 8, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@CybotTM
CybotTM merged commit 2853673 into main Aug 8, 2026
23 of 24 checks passed
@CybotTM
CybotTM deleted the feat/warn-on-handrolled-merge-readiness branch August 8, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants