Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using check-regexp, job fails if no actions were found that match that regex #93

Open
vlandau-vp opened this issue Nov 8, 2023 · 2 comments

Comments

@vlandau-vp
Copy link

I have a repo for which different checks are run depending on which files were changed. We needed to enforce that checks pass prior to merging in main, and this action was an excellent solution since it will always be run, and we can use it as a status check for PRs to our protected main branch. We have some cases where no other jobs/workflows are run (e.g. if files that don't matter are changed). In these cases, we get an exit 1 from this action with The requested check was never run against this ref, exiting... and the job fails.

I was able to work around this by adding a "dummy job" above the job that runs this action, so there is always at least one other job for the action to check success for, but I'm wondering if an option could be added that will allow this action to pass with success if no jobs are found that match the regex (something like succeed-on-no-regex-matches: true). I do understand this may not align with the original intent of this action, so no worries if this is a low priority (especially since we also have a working workaround).

@devops-corgi
Copy link

I'm running into this exact error right now even without regex.

Context: we have some checks that run in matrix (i.e. rspec via knapsack that triggers several parallel workers), and then a rollup job that combines them all into one simple check that can be used for branch protection and dependency.

Example, test job:

rspec:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        node_index: [0, 1, 2, 3, 4, 5]
    <... do stuff here ...>

  rspec_rollup:
    needs: rspec
    runs-on: ubuntu-latest

Then, I'm trying to use wait-on-check in a deploy workflow like this:

  wait_for_tests:
    runs-on: ubuntu-latest
    needs:
      - build_image
    if: github.ref_name == 'master'
    steps:
      - name: Wait for rollup
        uses: lewagon/[email protected]
        with:
          ref: ${{ github.ref }}
          check-name: rspec_rollup
          repo-token: ${{ secrets.GITHUB_TOKEN }}

Unfortunately, since rspec matrix job is often still running, rspec_rollup does not yet show up in the list of jobs. wait-on-check then doesn't see it in the list and exits with this error:

Checks completed: api_test_dev, deploy_nonprod, deploy_dev, build_image / build_image, db_sanity_rollup, rspec (5), db_sanity (db_sanity:data_migrations), rspec (4), db_sanity (db:create db:migrate), rspec (3), precompile_assets, rspec (1), rspec (0), 
Checks in_progress: wait_for_tests, rspec (2), build_production
Checks after check_name filter:
Checks after Regexp filter:
The requested check was never run against this ref, exiting...

I think the obvious fix would be for wait-on-check to keep waiting until it sees a check with the right name complete or fail.

It would likely also need a max timeout just in case the check never runs at all, or if there's a typo, etc.

@logonv
Copy link

logonv commented Jun 25, 2024

echo @devops-corgi's post. I have a similar issue.

(checks in a matrix, followed by one rollup job that starts afterwards. I want wait-on-check to check the rollup job)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants