How to trigger a CI/CD run without code changes
Sometimes you need to re-run your CI/CD pipeline without making any actual code changes. Common scenarios include:
- A previous CI/CD run failed due to a transient error (network timeout, service unavailability)
- You need to rebuild/redeploy after an infrastructure change
- You want to verify the pipeline is working correctly
- External dependencies have been updated and you need to refresh the build
Using an empty commit
Git allows you to create a commit with no file changes using the --allow-empty flag. This commit will trigger your CI/CD pipeline just like any other commit.
git commit --allow-empty -m "trigger workflow"
git push
This technique will not work if your workflow is configured with path filters. Workflows that use paths: only trigger when files matching those paths are changed. Since an empty commit has no file changes, it won't match any paths.
For example, this workflow will not be triggered by an empty commit:
on:
push:
branches:
- main
paths:
- .github/workflows/**
- automate/**
- transform/**
If your workflow uses path filters, you'll need to either make an actual file change or modify the workflow to support manual triggers using workflow_dispatch.
Best practices
Use a descriptive commit message - Instead of a generic message, describe why you're triggering the workflow:
git commit --allow-empty -m "Re-trigger CI after fixing Snowflake connection"
git commit --allow-empty -m "Rebuild to pick up updated dbt packages"
git commit --allow-empty -m "Re-run tests after transient failure"
Consider your branch - The empty commit will trigger CI/CD for whatever branch you're on. Make sure you're on the correct branch before running the command.
Check the pipeline first - Before creating an empty commit, verify that the issue causing the previous failure has been resolved.