I want to stop Vercel from creating preview deployments for the dependabot pull requests.
In Vercel, in the Ignored Build Step I've tried this:
bash vercel.sh
and in my repo, the vercel.sh file looks like this:
#!/bin/bash
echo "VERCEL_ENV: $VERCEL_ENV"
# check branch name
BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo "BRANCH: $BRANCH"
# check if branch name does not contain "Bump" (every dependabot PR starts with this)
if [[ $BRANCH != *"Bump"* ]]; then
exit 1
fi
exit 0
What am I missing? The deployment still went through.
Also tried writing this right to the Ignored Build Step
if [ "$VERCEL_GIT_COMMIT_AUTHOR_LOGIN" == "dependabot" ]; then exit 0; else exit 1; fi
Still created the deployment.
Tried it this way too
if (process.env.VERCEL_GIT_COMMIT_AUTHOR_LOGIN === "dependabot") {
process.exit(0);
} else {
process. Exit(1);
}
and then calling it like node ignore-nuild.js
in the Ignored Build Step, but this didn't help either.
Update
My bad, it was "dependabot[bot]", not just "dependabot".