How do I skip build step by files changes?

I want to prevent build step triggered on Vercel evetime I update files like Readme or .vscode I tried to google for it but only found solutions for skipping build by branches but not by files changes. Tried .vercelignore but it is useless, it just excludes file from build, build still trigger anyway.
Solution:
I suggest the solution is not to maintain some configuration of which files are supposed to trigger deployment, but instead always deploy when updating main branch you can configure to not deploy when updating your dev branch or whatever. I have put a file like this in some of my repos //ignore-build-check.sh...
Jump to solution
3 Replies
Sybatron
Sybatron•2y ago
GitHub
allow skip build by git commit message · vercel · Discussion #60
some ci support [skip ci] for skip ci task i hope now also can have one, something like [skip now] or [skip deploy]
senbonzakura123486
senbonzakura123486•2y ago
not sure how this solution work
Solution
andersgee
andersgee•2y ago
I suggest the solution is not to maintain some configuration of which files are supposed to trigger deployment, but instead always deploy when updating main branch you can configure to not deploy when updating your dev branch or whatever. I have put a file like this in some of my repos //ignore-build-check.sh
#!/bin/bash

#echo "VERCEL_GIT_COMMIT_REF: $VERCEL_GIT_COMMIT_REF"

# only deploy main and staging branches
# https://vercel.com/guides/how-do-i-use-the-ignored-build-step-field-on-vercel#with-a-script

if [[ "$VERCEL_GIT_COMMIT_REF" == "staging" || "$VERCEL_GIT_COMMIT_REF" == "main" ]] ; then
exit 1;
else
echo "🛑 - Build cancelled (not main or staging branch)"
exit 0;
fi
#!/bin/bash

#echo "VERCEL_GIT_COMMIT_REF: $VERCEL_GIT_COMMIT_REF"

# only deploy main and staging branches
# https://vercel.com/guides/how-do-i-use-the-ignored-build-step-field-on-vercel#with-a-script

if [[ "$VERCEL_GIT_COMMIT_REF" == "staging" || "$VERCEL_GIT_COMMIT_REF" == "main" ]] ; then
exit 1;
else
echo "🛑 - Build cancelled (not main or staging branch)"
exit 0;
fi
and you go to your project settings->git on vercel and put this in the "Ignored Build Step" box
bash ignore-build-check.sh
bash ignore-build-check.sh
Want results from more Discord servers?
Add your server