-
-
Notifications
You must be signed in to change notification settings - Fork 24
feat: add auto-fix option for automatic clang-format fixing #443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
shenxianpeng
wants to merge
25
commits into
main
Choose a base branch
from
feature/auto-fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
e2e0e86
feat: add auto-fix option to automatically format and commit clang-fo…
shenxianpeng 9ecd4de
refactor: rename fix-commit-msg to auto-fix-commit-msg for consistency
shenxianpeng b5aa8fc
fix: address review feedback for auto-fix implementation
shenxianpeng 90ef577
fix: change args from let to mut for reassignment compatibility
shenxianpeng 355cbfa
refactor: use git -c for commit author instead of global git config
shenxianpeng f84c0ed
docs: document CI re-triggering limitation and fork PR incompatibility
shenxianpeng 883fdfc
feat: add auto-fix-git-user and auto-fix-git-email inputs
shenxianpeng 43b4905
chore: Apply suggestions from code review
shenxianpeng 88d5c80
chore: let auto-fix-git-user/email defaults reference env vars directly
shenxianpeng fbfbf55
fix(auto-fix): gate to same-repo PRs, avoid stray commits
shenxianpeng cd071f6
chore: update auto-fix-commit-msg default value
shenxianpeng 148523a
docs: correct what auto-fix does to CI runs and to unchanged lines
shenxianpeng 7aae5aa
docs: describe the GitHub App token setup for auto-fix
shenxianpeng b064aec
Apply batched suggestions from code review
shenxianpeng 1678b6a
docs: surface the GitHub App token chapter in the README
shenxianpeng 3dcf220
Apply batched suggestions from code review
shenxianpeng da9a8d4
Apply batched suggestions from code review
shenxianpeng e1bbeb8
fix(auto-fix): address review: no forced checkout, source-only commits
shenxianpeng d6664a0
fix(auto-fix): stop checking out the PR head; require it from the wor…
shenxianpeng ae9f3d0
refactor(auto-fix): fold the fork warning into the commit step, trim …
shenxianpeng 8feb22c
test: run auto-fix in the self-test
shenxianpeng c9db607
fix(auto-fix): check out the PR head in the action, count changes aft…
shenxianpeng b4e1034
test: run the auto-fix self-test on the default checkout
shenxianpeng 25f45eb
fix(auto-fix): skip fork pull requests on every event, not only pull_…
shenxianpeng adbb9f0
fix(auto-fix): run the git steps in repo-root
shenxianpeng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: cpp-linter (auto-fix) | ||
| on: | ||
| pull_request: | ||
| branches: [main, master, develop] | ||
| paths: ['**.c', '**.cpp', '**.h', '**.hpp', '**.cxx', '**.hxx', '**.cc', '**.hh', '**CMakeLists.txt', 'meson.build', '**.cmake'] | ||
|
|
||
| jobs: | ||
| cpp-linter: | ||
| runs-on: ubuntu-latest | ||
| permissions: # explicit permissions granted to the `secrets.GITHUB_TOKEN` | ||
| contents: write # needed for auto-fix commits | ||
| pull-requests: read # needed to list changed files on pull_request events | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| # Pushes made with the default GITHUB_TOKEN do not start new workflow | ||
| # runs. To have the auto-fix commit re-checked by CI, check out and run | ||
| # the action with a GitHub App token; see the permissions docs. | ||
|
|
||
| - uses: cpp-linter/cpp-linter-action@v2 | ||
| id: linter | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| style: 'file' # Use .clang-format config file | ||
| tidy-checks: '-*' # disable clang-tidy | ||
| auto-fix: 'true' # auto-apply clang-format fixes | ||
|
|
||
| - name: Fail fast?! | ||
| if: steps.linter.outputs.clang-format-checks-failed > 0 | ||
| run: exit 1 |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.