-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
chore(ci): automatically format code #1035
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This reverts commit 9194553.
We can push a commit into PRs as well |
Sorry I don't get it. What do you mean by "push a commit into PRs"? The current implementation would already push commits if necessary. |
I mean, we can also auto-fix it if the PR is not formatted. |
name: Fix | ||
|
||
on: | ||
push: |
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.
add pull_request:
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 actually don't trigger this workflow for pull_request
events intentionally, and that's also the reason why I wrote this workflow in a separate YAML file instead of existed ci.yml
, as I want a different workflow trigger for this one.
For pull request events, GitHub actions won't run workflows on the development branch. It would first try to merge the development branch and the main branch, then run workflows on that merged commit. This means (a) we cannot run git push
directly, as the upstream if not the development branch, and (b) if the main branch has some newer commit, pushing the formatted code to the development branch would also include these new content. Because of these two reasons, It seems adding pull_request
is not a good idea.
My current implementation (i.e. run workflow on the push
event) can already fix the PR. This PR itself is an example. See the commit history below:
🎉 This PR is included in version 8.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Add a CI pipeline to automatically format code using Prettier and push the formated code to the origin branch. This CI won't push any commit to our main branches (
main
and `dev).