feat: auto-fix formatting for web UI commits in CI#5308
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates CI to automatically fix and commit formatting changes (Black/isort/Prettier) when a PR’s latest commit appears to come from GitHub’s web UI, reducing friction for occasional contributors who can’t easily run formatters locally.
Changes:
- Adds “web UI commit” detection to the
lintjob and conditionally runs formatters in fix mode, committing/pushing results back to the PR branch. - Posts PR comments describing what happened (auto-fixed vs. unable to auto-fix).
- Adds contributor documentation (new
CONTRIBUTING.md) and a PR template note for web UI contributors.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
CONTRIBUTING.md |
New contributor guide describing the auto-format behavior and local setup/format/test commands. |
.github/workflows/ci.yml |
Adds web UI detection, auto-format + auto-commit flow, and PR commenting for formatting results. |
.github/pull_request_template.md |
Adds a callout directing web UI contributors to the contributing guide. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot apply changes based on the comments in this thread |
|
@fpigeonjr The model You can try again without specifying a model (just If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: |
|
@fpigeonjr The model You can try again without specifying a model (just If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: |
1 similar comment
|
@fpigeonjr The model You can try again without specifying a model (just If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: |
Co-authored-by: fpigeonjr <4629398+fpigeonjr@users.noreply.github.com>
0169b50 to
2d7c299
Compare
|
🤖 Auto-formatting applied! I detected that this PR was edited via the GitHub web UI and had some formatting issues. I automatically applied fixes using:
The fixes have been committed to this branch. For future contributions, consider setting up the local development environment to run formatters before pushing - it avoids this extra round-trip. |
|
🎉 This PR is included in version 1.355.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Web UI contributors (docs fixes, small edits via GitHub's editor) were blocked by formatting CI failures with no easy path to fix them locally.
What changed
CI (
ci.yml—lintjob)git logcommitter identity:GitHub <*@noreply.github.com>github-actions[bot]with messagestyle: auto-format code (web UI commit)→ posts a PR comment explaining what happenedpermissions: contents: write, pull-requests: writescoped to the lint job only; usesghCLI and native git — no new external actionsDetection logic:
CONTRIBUTING.md(new).github/pull_request_template.mdIssue
https://github.com/HHS/OPRE-OPS/issues/
How to test
.pyor.js/.tsfile via GitHub's web UI, intentionally introducing a formatting issue (e.g., extra blank lines, wrong import order)Lintingjob: it should detectsource=web-ui, run the auto-fix steps, and commit astyle: auto-format code (web UI commit)commit to the branchCheck backend/frontend formattingsteps as beforeA11y impact
Screenshots
N/A — CI/workflow-only changes
Definition of Done Checklist
Links
stefanzweifel/git-auto-commit-actiondocs — not used; nativegit+ghCLI chosen instead to avoid adding external action dependenciesWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/repos/actions/github-script/git/refs/tags/v7.0.1/home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js(http block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.