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

The requested check was never run against this ref #29

Closed
CWSites opened this issue May 3, 2021 · 16 comments
Closed

The requested check was never run against this ref #29

CWSites opened this issue May 3, 2021 · 16 comments

Comments

@CWSites
Copy link

CWSites commented May 3, 2021

@progapandist if you have a moment can you please help me out?

  • I am explicitly naming my jobs
  • I'm using github.sha
  • It worked when I did everything against master but now it's not working with my default branch set to develop?
  • I'm using @master so that I have latest.

I'm running into the same problem as #7 and using the sha bafe56a6863672c681c3cf671f5e10b20abf2eaa which should have fixed it, so I'm not sure if it was reintroduced or if I'm doing it wrong.

Update: I used @master and github.sha which fixed the issue I was having. However now that I changed my default branch to be develop I'm having issues, see comments further down.

This is my config

  checks:
    name: Wait on "Lint, Test & Build" Workflow
    runs-on: ubuntu-latest
    needs: [verification]

    steps:
      - name: wait on tests
        uses: lewagon/wait-on-check-action@master
        with:
          ref: ${{ github.sha }}
          check-name: Lint, Unit Test & Build
          repo-token: ${{ github.token }}
          wait-interval: 20

This is the workflow that I'm waiting on

name: Lint, Test & Build

on:
  workflow_dispatch:
  repository_dispatch:
    types: [run-lint-test-build]

jobs:
  verification:
    name: Lint, Unit Test & Build
    runs-on: ubuntu-latest
@CWSites
Copy link
Author

CWSites commented May 3, 2021

Looks like using lewagon/wait-on-check-action@master fixes the issue, I guess the particular SHA which fixed it before still had some bugs.

@CWSites CWSites closed this as completed May 3, 2021
@CWSites CWSites reopened this May 5, 2021
@CWSites
Copy link
Author

CWSites commented May 5, 2021

This has been working fine for the past few days and today it started failing. I haven't changed my config at all and I'm able to verify that the ref I am passing in is actually being run.

A few thoughts around what could be causing it.

  1. Race condition - the wait on check looks before the workflow has had a chance to spin up.
  2. The workflow is already running with the same ref from another trigger

@BlueDrink9
Copy link

Affecting me too

@CWSites
Copy link
Author

CWSites commented May 7, 2021

I updated my jobs to use the sha instead and I haven't run into this issue since. I think it is an issue with the same ref being targeted by multiple actions.

@BlueDrink9
Copy link

BlueDrink9 commented May 7, 2021

Which SHA? The latest commit to master? @CWSites

@CWSites
Copy link
Author

CWSites commented May 8, 2021

Correct, when you are dispatching a workflow you can pass a client-payload like this...

    steps:
      - name: Repository Dispatch
        uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.REPO_ACCESS_TOKEN }}
          repository: ${{ github.repository }}
          event-type: run-lint-test-build
          client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'

After that you can use it like so

    steps:
      - name: Checkout source code
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.client_payload.sha }}

@BlueDrink9
Copy link

Ah, with dispatch being an additional dependency. The documentation says that it won't work for non-default branches, so it looks like I will have to wait for this issue to be solved.

@BlueDrink9
Copy link

It turns out I wasn't using the correct check. When I ran the api call with curl from the README, the workflow name didn't show up, only the individual jobs within it. Also, they were suffixed by the python version in the build matrix I had for them, so it looked like pytest (3.9) etc.

Still, that leaves no way to use this to wait for an entire extra workflow, only waiting on the individual jobs.

@CWSites
Copy link
Author

CWSites commented May 10, 2021

I'm running mine against master on merge. If master is your default branch then you could make this work. If you supply a name that will overwrite whatever weird thing that it's using.

@CWSites
Copy link
Author

CWSites commented May 14, 2021

Ah, with dispatch being an additional dependency. The documentation says that it won't work for non-default branches, so it looks like I will have to wait for this issue to be solved.

Where does it say that it won't work for non-default branches? I saw that it won't work for other repositories but not branches.

@CWSites
Copy link
Author

CWSites commented May 14, 2021

I can't find anywhere in the documentation for this workflow which states that the default branch must be used. I updated my default to be develop and I am using this workflow on my master branch anytime there is a merge. Since making this change I am continuously getting the error The requested check was never run against this ref.

I have verified that the Dispatch job is using the same SHA as the Wait job is using.

Dispatch Config

  verification:
    name: Dispatch - Lint, Test & Build
    runs-on: ubuntu-latest

    steps:
      - name: Repository Dispatch
        uses: peter-evans/repository-dispatch@v1
        with:
          token: ${{ secrets.REPO_ACCESS_TOKEN }}
          repository: ${{ github.repository }}
          event-type: run-lint-test-build
          client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'

Wait Config

name: Lint, Test & Build

on:
  workflow_dispatch:
  repository_dispatch:
    types: [run-lint-test-build]

jobs:
  verification:
    name: Lint, Format & Build # used for check-name on version.yml
    runs-on: ubuntu-latest

    steps:
      - name: Checkout source code
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.client_payload.sha }}
      - run: echo using SHA ${{ github.event.client_payload.sha }}

      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 12

      # https://github.com/marketplace/actions/yarn-install-cache
      - name: Cache yarn dependencies
        uses: c-hive/gha-yarn-cache@v1

      - name: Install dependencies
        run: yarn install

      - name: Lint Code
        run: yarn lint

      - name: Code Format Check
        run: yarn format:check --verbose

      - name: Build
        run: yarn build
        env:
          CI: true

@CWSites
Copy link
Author

CWSites commented May 14, 2021

Closing this one in favor of #30 since the original issue has been resolved.

@CWSites CWSites closed this as completed May 14, 2021
@karkir0003
Copy link

@progapandist I'm having this exact issue even when I change to using the master version and changing {{github.ref}} to {{github.sha}}. Any other fixes I can try

@vezaynk
Copy link

vezaynk commented Jan 31, 2023

Likewise ^

@karkir0003 Have you figured out a fix/workaround?

@karkir0003
Copy link

I think I was able to resolve this issue. I needed to add

on:
  push/pull (choose):
      branches:
        - <branch-name-here>
- name: Wait for tests to succeed
  if: ${{github.ref}} = "refs/heads/<branch-name>"
  uses: lewagon/wait-on-check-action@v1.1.1
  with:
      ref: $${{github.sha}}
      check-name: <name of check to wait on 
      repo-token: <PAT token here>
      allowed-conclusions: success
      verbose: true
      wait-interval: 10

This structure worked for me @vezaynk

@vezaynk
Copy link

vezaynk commented Jan 31, 2023

I figured out a better way of doing this in bash and jq. Here is an example of a script that doesn't complete until all jobs are completed on master:

until gh run list -R my/repo -b master --json status | jq '[.[].status] | unique' | jq '. - ["in_progress", "queued", "completed"]' | jq -e '.[0]'
do
   echo "Waiting..."; 
   sleep 2;
done

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

4 participants