GitHub Action for Linting with Vercel
I’m trying to setup GitHub Actions to lint and prettify the code in my turborepo monorepo; it’s great and works really well to get everything set, but it’s throwing an error from Vercel; the
lint-action
user doesn’t have access to my Vercel account to create a preview deployment, and at the same time I don’t want linting to create a separate deployment. Given these things, is there a reason to use actions for this instead of something like lint-staged
as a pre-commit hook?38 Replies
You just need a job that does something like this
Don't deploy anything
Okay so to be very clear - is the action creating a commit with the formatting done?
Want to gauge my roast appropriately
Yes…
Okay, that's very very bad
Actions should flag code that is bad, not fix it
So don’t auto fix is what you’re saying?
Depends on your definition of "auto fix"
The Git host is 10000% the wrong place to autofix
The goal of CI is to validate, not fix
Fwiw I don't even do typechecks on the Vercel build, I let it deploy if it is at all possible for it to build. I HARD BLOCK merging to main on our CI tho (typechecks, lint and prettier)
+1 for a pre commit hook that isn't a bad idea
I personally hate precommit hooks but that is the thing you're looking for here
This is cursed
VERY cursed
The IDE should catch this stuff as you work to be fair
Never been so tempted to open an issue on a repo that's just "this is bad please archive it"
But like,,,
Please don't do this.
This this this this
If your editor is failing you, CI should ALERT you to that
CI test for it if you're vaguely worried about it tbh
CI is really cool
I don't like precommit hooks because they force developers to use git a specific way, I don't like prescribing workflows to my teams
But if you really want the "act of committing" to "imply that the code will auto-fix" for some reason, sure go nuts
don't do that on github
Okay this is really good to know, I’m super new to actions tbh and I’ve been eliminating pre-commit hooks for precisely that reason.
Theo - ping.gg (@t3dotgg)
People have github actions that make code changes??? Oh god oh no this is like precommit hooks but 100x worse
Twitter
You inspired a tweet
Fuck
Well, here’s to that not happening again. 🤙🏻
No worries lol
The real inspo is the 400 stars that AWFUL plugin had
Ty for bringing this to my attention
I mean, I’m honored. I got rid of this action as soon as I saw it making commits that were trying to deploy, but I was trying to figure out a better way to get the same effect. Do you recommend setting up actions to run deployments to Vercel, rather than the Git auto-deploy?
Nah the GitHub auto deploy is great
What’s your specific goal with actions here? Preventing extra deploys?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Do you block the Vercel deploy on the tests?
My main issue with pre commit hooks is them slowing work flow down enough to put people off atomic commits
I would higly recommend just using husky for this, I use it in a couple of my projects as a pre commit hook and it works great
Mostly just linting and prettifying, but talking this through made me realize that autoSave in the IDE should be doing all of that already. So what’s the way to lint/prettify/typecheck production deployments?
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
See my code snippet above
This was how I realized I needed to get rid of my pre-commit hooks; team members weren’t committing often enough and the hooks were doing stupid, unnecessary shit.
I once saw a team run all tests on it so it was mental
That answers my Q. Curious now why you ignore tests 👀👀
I have seen this a few times. PRECOMMIT HOOKS ARE NOT CI
My time is more valuable than the GitHub actions quota
I ler CI find an issue and then I fix it later, then I'm not waiting I can do other stuff
It doesn't deploy until it's all groovy unless I force it
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
AH the coverage rule. That’s silly I hate codecov
I’m so triggered https://twitter.com/cramforce/status/1571603473380278272?s=46&t=7ESsoMAhKS2y4KMB-rb5aA
Malte Ubl (@cramforce)
@t3dotgg It can use ISR. The issue is that the Twitter API can only look back 7 days. So you need to store data somewhere and git is right there.
Twitter
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
What would you want the collab channel for?
Actually don’t steal this
Make a thread about it in #suggestions
I am sorry for what I’ve started 😂
To be fair it’s a very important convo and I’m learning…things
Mostly how I am unsure of my choice in idols 😅😅😅
Same; glad we had this learning experience 😂. Like I said earlier, I’m brand new to using GitHub actions this has given me a lot more to research. 🫠🫠