Skip to content

chore: enforce pre-PR validation (aggregate scripts, git hooks, PR checklist)#1061

Merged
gdams merged 2 commits into
actions:mainfrom
brunoborges:chore/enforce-pre-pr-checks
Jun 26, 2026
Merged

chore: enforce pre-PR validation (aggregate scripts, git hooks, PR checklist)#1061
gdams merged 2 commits into
actions:mainfrom
brunoborges:chore/enforce-pre-pr-checks

Conversation

@brunoborges

Copy link
Copy Markdown
Contributor

Description

Contributors occasionally open PRs that fail CI for avoidable reasons — most often Prettier format-check violations or a stale dist/ bundle — because the local format/lint/build/test steps weren't run before pushing. This PR adds lightweight tooling to make those checks easy to run and hard to forget.

This implements the agreed-upon enforcement measures (the maintainer enabled required status checks separately):

Aggregate npm scripts

  • npm run checkformat-check + lint + build + test (mirrors what CI runs).
  • npm run fixformat + lint:fix + build.

Git hooks (husky + lint-staged)

Installed automatically on npm install via the prepare script:

  • pre-commit runs lint-staged (Prettier + ESLint --fix on staged *.ts, Prettier on staged *.{yml,yaml}).
  • pre-push runs npm run build && npm test.

PR template & docs

  • Added a checklist item prompting contributors to run npm run check locally.
  • Documented the aggregate scripts and hooks in docs/contributors.md.

Why dist/ is not auto-committed by CI

Auto-committing the rebuilt dist/ bundle from CI was deliberately excluded: writing to the repo from workflows that run untrusted PR code is a pwn-request security risk. The existing Check dist/ workflow continues to verify the committed bundle matches source.

Related issue

Follow-up to the maintenance discussion about contributors not running pre-PR checks (PRs #672 and #1017 failed solely on Prettier formatting).

Check list

  • Ran npm run check locally (format, lint, build pass; the only failing test is a network-dependent JetBrains test that cannot reach CloudFront in the sandbox).
  • Documentation updated.
  • Tests added — N/A (tooling/CI change only).

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

…nd PR checklist

Add tooling to help contributors run the same checks as CI before
submitting a pull request, reducing avoidable format/lint/build failures.

- Add aggregate npm scripts:
  - `npm run check` runs format-check + lint + build + test (mirrors CI)
  - `npm run fix` runs format + lint:fix + build
- Add husky + lint-staged git hooks (installed via `npm install`):
  - pre-commit formats and lints staged files
  - pre-push rebuilds dist/ and runs the test suite
- Add a checklist item to the PR template prompting contributors to run
  `npm run check` locally
- Document the aggregate scripts and hooks in docs/contributors.md

dist/ is intentionally not auto-committed by CI to avoid pwn-request
security risks; the existing `Check dist/` workflow continues to verify it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@brunoborges brunoborges requested a review from a team as a code owner June 25, 2026 17:13
Copilot AI review requested due to automatic review settings June 25, 2026 17:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds local, contributor-facing tooling to reduce avoidable CI failures by making the repo’s standard format/lint/build/test validations easier to run (via aggregate scripts) and harder to forget (via git hooks + checklist/docs).

Changes:

  • Added aggregate npm scripts (check, fix) and configured lint-staged.
  • Introduced Husky-managed pre-commit and pre-push hooks to run staged formatting/linting and build/tests.
  • Updated contributor documentation and PR template to prompt running npm run check.
Show a summary per file
File Description
package.json Adds aggregate scripts, prepare hook install, lint-staged config, and new dev deps (husky/lint-staged).
package-lock.json Locks new dev dependencies and their transitive dependencies.
docs/contributors.md Documents the new check/fix scripts and the automated hooks.
.husky/pre-commit Adds a pre-commit hook invoking lint-staged.
.husky/pre-push Adds a pre-push hook running build + tests.
.github/pull_request_template.md Adds a checklist item to run npm run check locally.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 5/6 changed files
  • Comments generated: 4

Comment thread .husky/pre-commit
Comment thread .husky/pre-push
Comment thread package.json Outdated
Comment thread package.json
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@gdams gdams merged commit 623c707 into actions:main Jun 26, 2026
381 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants