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

Automate cargo +nightly fmt on push #506

Merged
merged 2 commits into from
May 1, 2021

Conversation

kazk
Copy link
Member

@kazk kazk commented May 1, 2021

Automate what @clux has been doing after merging PRs (#505 (comment)). Uses https://github.com/marketplace/actions/git-auto-commit to commit any changes after cargo +nightly fmt --all.


It's also possible to do this when PRs are opened. But to handle PRs from forks, we need to use pull_request_target event and forks needs to have GitHub Actions enabled.

Copy link
Member

@clux clux left a comment

Choose a reason for hiding this comment

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

Looks great. Thank you! Would move the whole rustfmt thing into "don't want to think about it" territory.

on:
push:
branches:
- master
Copy link
Member

Choose a reason for hiding this comment

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

nit: we can probably lift this down into the commit action, i believe.
may at least try to run rustfmt everywhere possible?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to run this when pushed to any branch in your repo.

@kazk kazk changed the title Automate cargo +nightly fmt on push to master Automate cargo +nightly fmt on push May 1, 2021
@clux clux merged commit e62c199 into kube-rs:master May 1, 2021
@kazk kazk deleted the chore/automate-cargo-fmt branch May 1, 2021 09:31
@kazk
Copy link
Member Author

kazk commented May 17, 2021

@clux The push after rustfmt failed because master is protected. https://github.com/clux/kube-rs/runs/2604434250#step:5:54
We should be able to change the checkout action to use your personal access token, and commit as you. See https://github.com/stefanzweifel/git-auto-commit-action#push-to-protected-branches
Or use force push.

@clux
Copy link
Member

clux commented May 17, 2021

Ah, that makes sense. Thank you. Ok. I'll probably set up a PAT and fix that up next PR. But ugh, the permissions on these PATs are a bit scary.

@kazk
Copy link
Member Author

kazk commented May 17, 2021

Yeah :( It should be possible to create a PR automatically based on the changes. I can look into that.

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