How to Make a Build Check Pass While the Thing It Protects Is Broken
This guide explains how to make a CI build check pass even when the code or functionality it is supposed to protect is currently broken. It is intended for developers who need to temporarily bypass a failing check (for example, to unblock a merge or deploy) while they fix the underlying issue. You will learn several practical methods, from simple configuration changes to more surgical code edits, along with the risks and best practices for each.
What You’ll Need
- Access to the repository where the build check is defined (e.g., GitHub, GitLab, Bitbucket).
- Understanding of the CI system in use (e.g., GitHub Actions, Jenkins, CircleCI, Travis CI).
- Basic command-line knowledge to run git commands and edit files.
- Permission to push to the branch or open a pull request.
Step-by-Step
- Identify the failing check. Look at the CI status on your pull request or commit. Note the exact name of the check (e.g., “build”, “test”, “lint”). Open the logs to see why it is failing—this will help you choose the least harmful bypass.
- Assess the risk. Determine if the check is a hard requirement (required status check) or optional. If it is required, you will need to either temporarily disable it or use a method that makes it pass without fixing the root cause.
- Option 1: Temporarily disable the check in CI configuration. Edit the CI configuration file (e.g.,
.github/workflows/ci.yml,.gitlab-ci.yml,Jenkinsfile) and comment out the failing step or change its condition toif: falseorwhen: manual. Commit and push. This is the quickest but most visible method—make sure to revert it after. - Option 2: Use a skip keyword. Many CI systems support skip keywords in commit messages, such as
[skip ci](GitHub Actions, Travis CI) orci skip(GitLab). Push a commit with the keyword to bypass the entire pipeline. This works only if the repository allows it and the check is not a required status check that ignores skips. - Option 3: Modify the check to be non-blocking. In some CI systems (e.g., GitHub Actions), you can set the check as
continue-on-error: truefor the failing step. This makes the step run but not fail the build. Edit the workflow file, add the line, and push. - Option 4: Override the required status check via admin. If you have admin rights, go to the repository settings (e.g., GitHub > Settings > Branches) and temporarily uncheck the branch protection rule that requires the check to pass. Merge your PR, then re-enable the rule. This is risky because it bypasses all checks, not just the failing one.
- Option 5: Make a code change that satisfies the check without fixing the bug. For example, if a unit test is failing, you could modify the test to expect the broken behavior, or add a
@Ignoreannotation (in JUnit) or@pytest.mark.skip(in pytest). This is a code-level bypass that keeps the check running but not failing. Use this as a last resort because it hides the problem. - After bypassing, create a follow-up task. Regardless of the method, create an issue or ticket to fix the underlying problem and remove the bypass. Set a reminder to do it soon—otherwise, the broken state may become permanent.
Common Mistakes
- Forgetting to revert the bypass. Leaving
continue-on-erroror a skipped test in place means the check will never catch the issue again. Always revert after fixing the root cause. - Using skip keywords on required checks. Some systems ignore skip keywords for required status checks, so the build will still fail. Check your CI documentation.
- Disabling the entire pipeline. Skipping all checks (e.g.,
[skip ci]) may hide other legitimate failures. Prefer to disable only the failing step. - Changing the test to match broken code. This is a code smell and can mislead other developers. Only do this if you are absolutely sure the test is wrong, not the code.
- Not communicating with the team. If you bypass a check without telling anyone, teammates may merge broken code unknowingly. Always mention the bypass in the PR description.
Tips
- Prefer the least invasive method. If you only need to unblock a merge, temporarily disabling the specific check is better than skipping the whole pipeline.
- Use branch protection rules wisely. If you have admin rights, temporarily removing the required status check is a common practice, but make sure to re-enable it immediately after the merge.
- Keep a record. Note in the PR description or commit message that a check was bypassed and why. This helps future developers understand the context.
- Fix the root cause as soon as possible. The longer you wait, the harder it is to remember what the bypass was for. Set a deadline.
- Consider using a separate branch. If the check is blocking a merge, you can merge the branch with the bypass and then immediately create a fix branch. This keeps the main branch clean.
Troubleshooting
- Check still fails after using
continue-on-error. Make sure you added the line to the correct step in the workflow file, and that the step is not a separate job that is required. If it is a job, you may need to setcontinue-on-errorat the job level. - Skip keyword not working. Verify that the keyword is exactly as documented (e.g.,
[skip ci]vsci skip). Also check if the repository has disabled skip keywords in settings. - Admin override not available. If you don’t have admin rights, ask a maintainer to temporarily change the branch protection rule. Alternatively, use a code-level bypass.
- Test still fails after adding
@Ignore. Ensure the annotation is on the correct test method, and that the test runner is configured to respect it. Some frameworks require additional configuration. - Build passes locally but fails in CI. This is a separate issue—likely environment differences. Check the CI logs for missing dependencies or different versions. A bypass is not the right fix; instead, align your local environment with CI.
Frequently Asked Questions
Is it ethical to bypass a build check?
It is acceptable in emergency situations to unblock a critical path, but it should be temporary and clearly communicated. The goal is to fix the underlying issue as soon as possible.
Will bypassing a check affect the final production build?
It depends on the check. If you skip a linting check, the code may still work but have style issues. If you skip a security scan, you might deploy vulnerable code. Always consider the risk.
Can I bypass a required status check on GitHub without admin rights?
No, only admins can change branch protection rules. You can use other methods like [skip ci] or continue-on-error if the repository allows them.
What is the safest way to bypass a check?
The safest is to temporarily disable the specific failing step in the CI configuration, because it leaves the rest of the pipeline intact. Always revert the change after fixing the issue.
How do I know if a check is required?
In GitHub, go to Settings > Branches and look at the branch protection rules. If a check is listed under “Require status checks to pass before merging”, it is required. In GitLab, similar settings exist under Settings > CI/CD.
What if the check is failing because of a flaky test?
Instead of bypassing, try re-running the test first. If it still fails, investigate the flakiness. Sometimes a temporary bypass is acceptable, but you should fix the flaky test soon after.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.