You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Idea: A bot to run pre-commit and commit formatted code #211
It would be great to have a GitHub bot that could execute pre-commit run ... on a PR then add a commit to the PR with the formatting changes, if there are any.
This would act as a last resort, ensuring that both maintainers and contributors don't need to care about formatting code.
Does this exist? If not, is there any interest in collaborating on something like this?
This Github action would would save so much time. I found this existing action that look like a very close match. Maybe just adding pre-commit run --all-files would work:
jobs:
build:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@v2with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal tokenfetch-depth: 0# otherwise, you will failed to push refs to dest repo
- name: Create local changesrun: | pre-commit run --all-files
- name: Commit filesrun: | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git commit -m "Add changes" -a
- name: Push changesuses: ad-m/github-push-action@masterwith:
github_token: ${{ secrets.GITHUB_TOKEN }}branch: ${{ github.ref }}
Activity
asottile commentedon Feb 4, 2019
Seems like a fine idea -- though I don't have the slightest idea on where to host such a thing however
I'm going to move this to the docs repo since it's less about the framework and more about ancillary tools.
I'd be happy to help set something like this up if there's interest and direction 👍
I believe @nicoddemus @RonnyPfannschmidt @obestwalter have expressed interest in a similar thing in the past as well, CCing them in case they have input
sloria commentedon Feb 4, 2019
The Probot docs have deployment instructions for Glitch, Heroku, Now, GH Actions, AWS Lambda, and Google Cloud Functions: https://probot.github.io/docs/deployment .
sloria commentedon May 3, 2019
I wonder if this makes more sense as a GitHub Action. There's already actions implemented for a number of linters and formatters: https://github.com/bltavares/actions
asottile commentedon May 3, 2019
I really really really want to set up a github action but I haven't been allowlisted into the beta yet :'(
sloria commentedon Jul 2, 2019
The Restyled project (https://restyled.io/) uses GitHub actions to run formatters against PRs. I've suggested adding pre-commit support: restyled-io/restylers#29
Pierre-Sassoulas commentedon Apr 29, 2021
This Github action would would save so much time. I found this existing action that look like a very close match. Maybe just adding
pre-commit run --all-fileswould work:chriskuehl commentedon Apr 29, 2021
@Pierre-Sassoulas have you seen https://pre-commit.ci/? It is developed by the primary pre-commit maintainer and sounds like exactly what you want.
asottile commentedon Apr 29, 2021
yeah this isn't possible to do safely with github actions -- so I made pre-commit.ci which is now the official way to run pre-commit in CI for github