102

I have a pull request, build passed on VSTS, but another check "Expected - Waiting for status to be reported" never succeeds, no matter how many times I try to trigger build. I had many other pull requests with no issues.

I am not sure how to tackle this problem, how to debug this? There is no specific info than this: enter image description here

Where should I check first to resolve this?

4
  • 4
    i gave up on this and disabled.
    – sensei
    Oct 14, 2018 at 20:04
  • 20
    The solution is to assume that github actions are unreliable. Notice that all the answers here are workarounds that basically just have ways to ask github to do something again that should have worked the first time. Feb 24, 2021 at 18:52
  • 1
    @JamesMoore github actions are reliable and work the first time. Because the posters are giving hacks, doesn't mean that's an actual solution. The problem here more than likely is the status check in branch protection does not match the job name exactly. It's a user error Nov 2, 2022 at 17:40
  • 2
    @NickTurner That was absolutely not our real-life experience in early 2021. github actions would often fail to complete successfully. In late 2022, I think things are significantly better, but I really haven't been using them much lately. Nov 2, 2022 at 18:53

21 Answers 21

85

This can happen sometimes, what you can do is to push an empty commit to the branch of the PR. It will re-trigger all the checks you have in CI. This can be done using git command.

git commit --amend --no-edit

and then force push your branch.

git push --force-with-lease
4
  • 14
    If the PR already approved it would then stale the status, because amend would change the commit hash
    – otong
    Jan 25, 2021 at 2:09
  • @otong That depends if "Dismiss stale pull request approvals when new commits are pushed" is enabled or not.
    – Pär Berge
    Dec 6, 2022 at 19:58
  • 2
    Wouldn't git commit --allow-empty && git push better?
    – Snailedlt
    Feb 17 at 23:26
  • @Snailedit this would force you to write a commit message I think
    – Timon
    Mar 14 at 18:43
37

TL;DR

If this status check is necessary before merging, use a Personal Access Token instead of the default secrets.GITHUB_TOKEN for creating this PR in your github action:

- name: Create Pull Request
  uses: peter-evans/create-pull-request@v3
  with:
    token: ${{ secrets.YOUR_PAT }}

If not, simply uncheck this under repo setting, in your protected branch:

enter image description here

Reasons

There're restrictions on github actions triggering other github actions, by design. So if you have the setting x must pass before branch can be merged, some actions could get stuck in limbo forever.

This is also why "push an empty commit" or "close and reopen the PR" can unstuck it--because then the PR is no longer purely action triggered. This is also why switching to PAT works, because using secrets.GITHUB_TOKEN implies this PR is github-action-initiated. While using a PAT, it's initiated by a user.

How to debug

I am not sure how to tackle this problem, how to debug this? There is no specific info than this: waiting for status to be reported

I find other people's debugging process generally more illuminating than the solutions themselves, so, glad you asked! Here's how I came to my conclusions:

  • From googling "Expected — Waiting for status to be reported", I got to this top result, where ​I found the above setting change vaguely described in the comments.
  • Then from reading the description of this setting, I understood it to mean that the reason I see this status is because I've configured for it to must pass before any branch can be merged, but for some reason this branch does not trigger it.
  • So I considered what made this branch different from all the other branches that were triggering correctly. One big difference is that this PR is triggered by another action. Running with this theory, I googled "github action doesn't trigger when PR created by bot", and got this first result, which explained why.
  • Finally I double checked other similar actions in other repos, and curiously, some action triggered PRs had runs below, but some don't. I compared their definitions, and noticed that the limboed ones were using secrets.GITHUB_TOKEN as token when creating PR, while the correct ones were using PAT. And indeed those PRs were headed by this octopus while the correct ones were headed by user icons:

enter image description here

Case closed.

4
  • Using a PAT instead of GITHUB_TOKEN will make the action able to read/write on all repositories that the account has, right? Sep 17, 2022 at 14:39
  • This is because your pipeline failed as some point. Removing restriction is a very bad thing and should not be done. Oct 28, 2022 at 21:08
  • And to add, you shouldn't be putting a PAT in the pipeline. It will be there forever. It's best to set up a BOT account and add to secrets. However, GITHUB_TOKEN will not cause the pipeline to fail and should always be used unless you're using cross repo calls. Oct 28, 2022 at 21:11
  • Good answer, for the record I had a workflow build explicitly mentioned under the "require status checks to pass before merging" and then did some changes to my workflows - for me the solution was to uncheck this option and check it again Nov 15, 2022 at 8:31
35

The simplest solution for me was closing the PR and opening it again. After that, checks where executed as expected.

There's a button on GitHub that makes it very easy.

enter image description here

5
  • 1
    This will also clear Approvals, right? Mar 16, 2022 at 20:43
  • 8
    @MichaelChirico No, it does not clear approvals
    – andreswebs
    Mar 25, 2022 at 11:46
  • 1
    But you lose all pr comments that may be needed. It's best to see why it's failing, hence no status check Oct 28, 2022 at 21:09
  • 1
    After trying multiple answers here this is what worked. Jul 6 at 2:14
  • simple and clear solution without changing anything else
    – Jaydatt
    Sep 5 at 5:47
17

I believe you need to double-check that the name of the job in the yml file is exactly the same as in Branch protection rule / Status checks that are required. Be aware it is case sensitive I spent some time fixing this issue but it turned out it expected build job to finish whereas I had Build

2
  • 3
    This is the answer Nov 2, 2022 at 17:41
  • Can confirm this was our issue. We've updated some jobs and the branch protection rule still had the old action jobs required to pass. When you make a change in your action workflow, you have to manually update the ones under "Require status checks to pass before merging" too. Jul 31 at 15:40
11

I found a workaround! You need to create a new PR for the same commit using different branch name. This will kick the build upon completion both original and new PR will get status update. Then you can merge the original and close the new one.

If PR was created from remote repository you can pull the ref to your repository locally by following these instructions:

git fetch origin pull/{id}/head:temporary
git push origin temporary
4

For me nothing helped but waiting. The reason was that GitHub was partially down. Check for current status on https://www.githubstatus.com

2
  • It may be rare, but it's still a good tip if nothing else seems to help.
    – RiZKiT
    Mar 30 at 8:08
  • 1
    This happened to me yesterday, thanks! May 11 at 14:46
2

It's working for me: close the stuck pull request and reopen it.

2

One case we seen this happens consistenly is (for example): when github has required PR build, but in the stages there is no stage what actually runs on PR. So Imaging that we have just one stage but with condition that it runs only on push, cron, api but not on pull_request.

  include:
     - stage: sample-stage
       if: type IN (push, cron, api)
       name: stage-name
       script:
         - mysript.sh

In this case, the travis will not run, at the github however will be:

Wating for status to be reported

As mentioned in question.

2
  • ok but what is the solution for that?
    – mikus
    Jan 23 at 17:07
  • this was a while ago, but I guess adding "pull_request" to "if type in (...)" part.
    – csviri
    Jan 24 at 9:58
2

In my case it happened when the Workflow was not trigerring. I corrected the branch on which the action should be trigerred and then it worked

1
  • This was the same issue for us, we were expecting to run on certain paths which caused the action not to trigger. May 25 at 15:59
1

You have to somehow refresh the PR, I changed the base of the to PR to some other branch and then back to master and it worked.

1
1

For our situation it turned out that we had added the following ignore into our workflows because we didn't want the status checks (which are lengthy code scans) to run when changes were just occuring with our actual changes to our workflows.

    paths-ignore:
    - '.github/workflows/**'

The problem was that the only changes were in the workflows folder and so the status checks are waiting for a run that will never happen. We had two solutions, one was to turn off those status checks for this PR or we removed the paths-ignore. We ended up removing the ignore and this kicked off the status checks (which are totally unnecessary) but it gets us past GitHub just waiting around forever.

0

To amels. All that you need it is only rerun build for the branch. I did it for the PR in GitHub and it helped me.

For example. Go to Jenkins (or where is build can be managed manually) via details link and select your branch that relates to your pull request then push "Build Now" link. This action will rerun branch build. After the build will complete the merge button will became accessible.

0

You can simply restart the jobs using the GitHub UI:

0
0

If there is conflict with master/main. In my case there was a conflict. I resolved that conflict and pushed another commit. It reworked as usual.

0

If your checks are starting and then getting stuck on pending , you need to look if the reported status checks are in a commit above that

for me a status badge that was pushed as part of my workflow, did not trigger the status checks to re-run

I had to add an ignore paths

on:
  push:
    # only trigger on branches, not on tags
    branches: '**'
    paths-ignore:
      - '**/README.md'

When I did that it passed

0

In my case the issue was that the search results contained two variants of the check names, one including the workflow name and one without.

check search results

Only the ones without the workflow name (i.e. validate-lambdas and validate-iac) worked for me - the other two just remained in Expected - Waiting for status to be reported status.

0

I did not want to disable the checks to fix this issue. But I disabled the Require status checks to pass before merging rule and enabled it again immediately.

Now when I checked the PR again the build passed. enter image description here

0

In my particular case, I had the default build as the name build (16.x) (because I haven't given it a valid one).

When I edited the workflow file and gave it a new name Code Formatting, it wasn't updating the status check to reflect that the workflow succeeded.

To fix it, I had to go to the specific branch on GitHub -> "Settings" -> "Branches" -> "Branch protection rules", select "Edit" on the desired branch (mine was main) then under "Require status checks to pass before merging" type in the name of the job:

enter image description here

Afterwards, I selected "Re-run all jobs" and the status check was successfully updated. You could also add a new commit or force push as mentioned on other answers to get the status check from updating.

0

I had a similar issue and it turned that merge conflicts were my problem: "Workflows will not run on pull_request activity if the pull request has a merge conflict. The merge conflict must be resolved first.", like stated here: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request

-1

No need to add empty commits. You can re-run the checks by adding the comment below in the PR:

/azp run
1
  • 1
    Is this only for Azure?
    – Jim
    Mar 25, 2022 at 17:18
-5

In March of 2022, this still happens. Refresh your browser (cmd-R on Mac, F5 on Windows/Linux) first. That worked for me - hope it works for you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.