This article addresses an issue where a Pull Request (PR) gets merged prematurely while CircleCI triggers another workflow. This situation often arises when using dynamic configuration, which initiates a "setup" job to determine the changed files and triggers code tests based on those changes. The problem occurs when the "setup" job completion is interpreted as a "passed" status check, causing the merge queue to merge the PR even before the actual tests are triggered.
- Enabled merge queues in GitHub.
- Dynamic configuration usage CircleCI
To resolve this issue, you can configure the timeout of the Status Check on Github. This adjustment allows CircleCI to allocate some time for the next workflow to run. The Status Check timeout determines how long the queue should wait for a response from CI before assuming that checks have failed.
As mentioned in the Github documentation:
"Status check timeout: Choose how long the queue should wait for a response from CI before assuming that checks have failed." - Managing Merges on GitHub
Please note that this feature is not provided by CircleCI, so we recommend checking GitHub for more details on setting it up.