Skip to content
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

Have github actions automatically push PR autofixes #3528

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

lihaoyi
Copy link
Member

@lihaoyi lihaoyi commented Sep 12, 2024

This will save the tedious process of noticing formatting/scalafix irregularities and having to run a manual command before pushing them.

@lihaoyi lihaoyi changed the title Have github actions automatically push PR fixes Have github actions automatically push PR autofixes Sep 12, 2024
Copy link
Member

@lefou lefou left a comment

Choose a reason for hiding this comment

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

Not sure how exactly this work or why there is this message "please use git push -f", but if you need --force please use --force-with-lease, making following a branch easier. Why do we encourage to force push at all? I always communicate the opposite, since it makes reviewing PRs much harded and GitHub UI looses all personal review state and I have to start over. Also, a lightly git push -f risks to loose commits made by other maintainers.

buildcmd: |
set -eux;
git fetch --unshallow;
git commit --allow-empty -am 'Github Actions Autofix; please use "git push -f" next time you push to this PR';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
git commit --allow-empty -am 'Github Actions Autofix; please use "git push -f" next time you push to this PR';
git commit --allow-empty -am 'Github Actions Autofix; please use "git push --force-with-lease" next time you push to this PR';

@lihaoyi
Copy link
Member Author

lihaoyi commented Sep 12, 2024

git push -f is just the way I've done this kind of CI-driven autofixes before, and it worked fine. The alternative is to ask people to git fetch the CI autofix before proceeding with local development, which works as well.

@lefou
Copy link
Member

lefou commented Sep 12, 2024

git push -f is just the way I've done this kind of CI-driven autofixes before, and it worked fine. The alternative is to ask people to git fetch the CI autofix before proceeding with local development, which works as well.

I have a alias git pullr for that which stands for pull --rebase --autostash. It will rebase all local commits on top of upstream changes. It will also work with local uncommitted changes, which will be temporarily stashed.

git push -f without fetching is dangerous, since you may loose some commits, without even noticing. We definitely should not recommend this.

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.

2 participants