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

Exit with non-zero exit code when files were changed #21

Closed
t-animal opened this issue Jul 2, 2020 · 3 comments · Fixed by #22
Closed

Exit with non-zero exit code when files were changed #21

t-animal opened this issue Jul 2, 2020 · 3 comments · Fixed by #22
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@t-animal
Copy link

t-animal commented Jul 2, 2020

Is your feature request related to a problem? Please describe.
In CI pipelines it would be handy to ensure that all imports are sorted. However, this requires checking for changes manually.

Describe the solution you'd like
If changes were done to any file, exit with exit code 1, otherwise exit code 0.

Describe alternatives you've considered
Checking if files have changed using git.

@github-actions
Copy link

github-actions bot commented Jul 2, 2020

👋 Hello! Thanks for submitting a issue 😄! @Matt-Gleich Will try to respond as soon as possible.

@gleich
Copy link
Member

gleich commented Jul 2, 2020

Ahh, this is a good idea! As a quick fix for your CI, you can just run the following command after running import_sorter: git diff --exit-code

@gleich gleich self-assigned this Jul 2, 2020
@gleich gleich added the enhancement New feature or request label Jul 2, 2020
@gleich gleich added this to the v4.0.0 milestone Jul 2, 2020
@gleich gleich mentioned this issue Jul 3, 2020
@gleich gleich closed this as completed in #22 Jul 3, 2020
@gleich
Copy link
Member

gleich commented Jul 3, 2020

Released! Check the README.md for the updated docs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants