-
Notifications
You must be signed in to change notification settings - Fork 187
build: merge code formatter CI workflow with the validation build, test only after formatter succeeds #22453
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
base: main
Are you sure you want to change the base?
Conversation
58cd01c
to
52aec19
Compare
b217255
to
347f208
Compare
a1b95ee
to
347f208
Compare
Merges the separate formatter workflow into the validation workflow with automatic commit and push capabilities for formatting changes. Changes: - Deleted standalone .github/workflows/formatter.yml - Integrated formatter as first job in validation.yml workflow - Added auto-commit functionality using PAT token (VAADIN_BOT_TOKEN) - Formatter now commits and pushes changes when formatting issues detected - Workflow stops after committing, new workflow run is triggered by the commit - On second run, detects bot commit and skips formatting, proceeds to validation - Changed workflow permissions to include contents:write for pushing commits - Build and test jobs only run if formatter succeeds (no changes or after bot commit) Infinite loop prevention: - Checks if last commit author is github-actions[bot] - If true, skips formatting step and proceeds to validation - Prevents endless formatting cycles if formatter is inconsistent Token requirements: - Requires VAADIN_BOT_TOKEN secret with repo and workflow permissions - Workflow fails immediately if token is not configured - PAT needed because GITHUB_TOKEN cannot trigger workflow runs PR comment behavior: - Posts comment when formatting changes are auto-committed - Deletes comment when formatting is correct - Includes list of files that were modified 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
ff69418
to
37e8c75
Compare
|
Just a question: do I understand correctly, that this change makes validation workflow unusable for external contributor PRs, since the bot cannot push to respective branches? If so, would it make sense to introduce a fallback to just checking formatting in the absence of push access? |
Most often contributors tend to check the checkbox that maintainers can make updates. Does this mean that formatting will also work? I have not tried |
build: | ||
formatter: | ||
needs: check-permissions | ||
if: github.event_name == 'pull_request_target' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, this condition needs to removed or adjusted. I tried dispatching this workflow from the PR branch manually using the dispatch button, here's what happened:
- it skipped the formatter job because it was not the
pull_request_target
event, - then it skipped the build job probably because
formatter
is required, - then it skipped the testing jobs also,
- ...and then it reported a false positive, oh no!
See: https://github.com/vaadin/flow/actions/runs/18466985120
Keeping the manual dispatch function working is useful for enabling maintainers to verify workflow changes from PR branches. Let's not limit the supported triggers. If auto-commit from the formatter isn't appropriate, it could fallback to checking only.
Merges the separate formatter workflow into the validation workflow with
automatic commit and push capabilities for formatting changes.
Changes:
Infinite loop prevention:
Token requirements:
PR comment behavior: