To configure Vercel to skip deployments when changes are made solely to the .github/
directory, the docs/
directory, or any Markdown (*.md
) files, you can set up the Ignored Build Step in your Vercel project settings. This ensures that modifications to these specific files or directories do not trigger unnecessary deployments.
Steps to Configure the Ignored Build Step:
-
Access Vercel Project Settings:
- Navigate to your project on the Vercel dashboard.
- Click on the Settings tab.
- Select the Git section.
-
Set Up the Ignored Build Step:
-
In the Ignored Build Step section, you can specify a command that determines whether a build should proceed based on the changes in your commits.
-
To skip builds when only files in the
.github/
anddocs/
directories or any Markdown files are modified, use the following command:# Check for changes outside the .github/ and docs/ directories and Markdown files if git diff --quiet HEAD^ HEAD -- .github/ docs/ '*.md'; then echo "Only .github/, docs/, or Markdown files changed; skipping build." exit 0 else echo "Relevant changes detected; proceeding with build." exit 1 fi
How:
git diff --quiet HEAD^ HEAD -- .github/ docs/ '*.md'
: This command checks if the differences between the latest commit and its parent are confined to the.github/
anddocs/
directories or any files matching the*.md
pattern.- If only these specified files or directories have changed, the script exits with status
0
, signaling Vercel to skip the build. - If other files have changed, it exits with status
1
, allowing the build to proceed.
-
-
Save:
- After entering the command, save your settings.
- Vercel will now execute this script for each commit to determine whether a build should be initiated.