We have a monorepo in Github. We have a CI workflow that we want to run on every commit that touches any web-related files. We don’t need the CI workflow to run at all if the commit contains mobile changes, or changes that otherwise are outside of the web directories, because the workflow only builds and tests the web code.
The trouble we’re having is with how CCI’s workflows interact with Github Checks. We want web-related PRs to successfully pass the CI workflow before they can be merged, and we are enforcing this with a Github check.
Unfortunately, Github checks are a repo-level setting, so this forces us to send mobile PRs through the same CI workflow, or the PRs don’t pass the Github check and cannot be merged. We’re currently working around this by checking within the workflow whether there are any changes on the current branch that have been made to a web directory, and running circleci-agent step halt in every job in the workflow if we detect that there are no such changes.
Our current approach works, but I’m wondering if there’s a better solution that doesn’t require us to essentially do early exits in the CI code, and that will allow us to skip running the CI workflow for mobile commits altogether without accidentally blocking any PRs from being merged. I also tried using CCI’s workflow cancellation API, but canceling the workflow causes the Github check where the workflow was canceled to be marked as a failure, which prevents us from merging the PR. (There’s not a way to cancel the workflow while marking its related checks as successful, is there?)
I know that one way of resolving this would be to split the web and mobile code into separate repos, but that requires us to migrate open PRs, Github issues, etc., to a new repo, and I don’t think that is worthwhile. Is there another solution I am missing that would let me do what I want?