-
-
Notifications
You must be signed in to change notification settings - Fork 85
pre-commit: Switch to GitHub action; add eslint fixer #1404
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
pre-commit: Switch to GitHub action; add eslint fixer #1404
Conversation
ef0f53b
to
6ee8083
Compare
bd85ba8
to
25f75e3
Compare
Huh pre-commit.ci lite unfortunately doesn't seem to work. I tried changing a lint rule to see if it would auto-fix, but nothing happens 😕 edit: Ok it did work, but man was it slow 😅 |
361752c
to
c3fbe0a
Compare
e25eff6
to
c9d5568
Compare
0d8bc03
to
49da5ad
Compare
Ok I switched the push action to https://github.com/stefanzweifel/git-auto-commit-action instead of pre-commit.ci lite, because the former is basically instant, whereas the latter seems to take a while |
.github/workflows/pre-commit.yml
Outdated
cache: pnpm | ||
- run: pnpm --color install | ||
- uses: pre-commit/[email protected] | ||
- uses: stefanzweifel/git-auto-commit-action@v4 |
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.
Does this work for forks?
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.
Good question. I'll give it a whirl
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.
Haven't tested yet, but looks like a bit of a hornet's nest and potentially introduces security vulnerability to get it to work 😬 stefanzweifel/git-auto-commit-action#211
So do we switch to pre-commit lite and deal with really slow commit, or switch to the setup from my other attempt with syncing versions? Downside of the latter is we can't easily run custom fixers like if we wanted to autoformat our recorded tests using our custom yaml writer
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.
Hmm. It might be possible to get something working with the completion of this workflow triggering another workflow that runs in the main
context? That'd be super complex though, and sounds like even more of a nightmare.
I've seen workflows that use a personal access token to get this sort of thing to work, but that's probably just as risky.
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.
Confirmed that this setup doesn't work for forks. See https://github.com/cursorless-dev/cursorless/actions/runs/4658630193/jobs/8244534702?pr=1409:
remote: Permission to cursorless-bot/cursorless-fork-test-2.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/cursorless-bot/cursorless-fork-test-2/': The requested URL returned error: 403
Going to take another swing at pre-commit.ci lite; maybe the slowness was just a one-off 🤷♂️
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.
Ok I switched back to pre-commit.ci lite; was actually quite fast this time around, so I'd be tempted to just ship it. Being able to run our own custom fixers using node scripts etc I think is worth the price of slower CI fixes
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 do wonder why GitHub's security policy doesn't allow GitHub actions to push from the context of the forked repo to a branch on that repo 🤔
FWIW we don't have to abandon pre-commit.ci entirely, we can skip eslint/prettier on pre-commit.ci and just run eslint and prettier on GitHub Actions |
What's the benefit of having both systems active? |
🤷 There's a potential cache speed benefit with pre-commit.ci, but I guess we don't know exactly how much caching will help us here since the cache doesn't exist on |
463745f
to
48226ec
Compare
pre-commit.ci is significantly faster, as you suspect, but tbh most of the fixes come from prettier, so I'm not sure the benefit of putting the other fixers in a different CI system justify the complexity / races of running two systems |
Checklist