Skip to content

Copilot: Enforce gh CLI usage for issue and PR operations#337

Merged
florian-h05 merged 1 commit intoopenhab:mainfrom
pgfeller:chore/enforce-gh-cli-usage
Apr 2, 2026
Merged

Copilot: Enforce gh CLI usage for issue and PR operations#337
florian-h05 merged 1 commit intoopenhab:mainfrom
pgfeller:chore/enforce-gh-cli-usage

Conversation

@pgfeller
Copy link
Copy Markdown
Contributor

@pgfeller pgfeller commented Apr 1, 2026

Summary

Adds workspace-level Copilot customizations to prevent the agent from opening GitHub issue and pull request URLs in a browser, and redirect it to use the gh CLI instead.

Changes

  • .github/copilot-instructions.md: workspace instructions listing preferred gh issue and gh pr commands, with an explicit rule never to open a browser page for GitHub issues or PRs
  • .github/hooks/block-github-browser.json: registers a PreToolUse hook pointing to the blocking script
  • .github/hooks/block-github-browser.sh: inspects every tool call before execution; denies open_browser_page and navigate_page calls whose URL matches a GitHub issue or PR pattern, returning a permissionDecision: deny with a hint to use gh instead

Add workspace-level Copilot customizations to prevent the agent from
opening GitHub issue and pull request URLs in a browser, and redirect
it to use the `gh` CLI instead.

- `.github/copilot-instructions.md`: workspace instructions listing
  preferred `gh issue` and `gh pr` commands, with an explicit rule
  never to open a browser page for GitHub issues or PRs
- `.github/hooks/block-github-browser.json`: registers a `PreToolUse`
  hook pointing to the blocking script
- `.github/hooks/block-github-browser.sh`: inspects every tool call
  before execution; denies `open_browser_page` and `navigate_page`
  calls whose URL matches a GitHub issue or PR pattern, returning a
  `permissionDecision: deny` with a hint to use `gh` instead

Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
@pgfeller
Copy link
Copy Markdown
Contributor Author

pgfeller commented Apr 1, 2026

@florian-h05 ➡ ready for your review

@florian-h05 florian-h05 changed the title chore: enforce gh CLI usage for GitHub issue and PR operations chore: enforce gh CLI usage to Copilot for issue and PR operations Apr 2, 2026
@florian-h05 florian-h05 changed the title chore: enforce gh CLI usage to Copilot for issue and PR operations Copilot: enforce gh CLI usage for issue and PR operations Apr 2, 2026
@florian-h05 florian-h05 changed the title Copilot: enforce gh CLI usage for issue and PR operations Copilot: Enforce gh CLI usage for issue and PR operations Apr 2, 2026
@florian-h05 florian-h05 merged commit 93aa637 into openhab:main Apr 2, 2026
6 checks passed
@pgfeller pgfeller deleted the chore/enforce-gh-cli-usage branch April 5, 2026 08:50
@pgfeller pgfeller self-assigned this Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants