Cancelled Github actions fails PR checks

Hi,

I have setup Github actions for our company private repo to automatically deploy static site when new commits are pushed to master. To do this I use Filters for GitHub Actions. But when I create PR with new content filter action end with neutral status and the rest of actions (build and deploy) are cancelled which cause check to fail. And thus PR cannot be merged unless I disable the checks as mandatory in repo settings. 

Is this supposed behaivior? Or is there some way how to avoid this? I couldn’t find any relevant information about this. Below is my my workflow file:

workflow "Deploy to Firebase" {
  on = "push"
  resolves = ["Deploy"]
}

action "On master branch" {
  uses = "actions/bin/filter@master"
  args = "branch master"
}

action "Build" {
  needs = "On master branch"
  uses = "./.github/gatsby-build"
}

action "Deploy" {
  needs = "Build"
  uses = "webscopeio/firebase-deploy-github-action@master"
  secrets = ["FIREBASE_AUTH_TOKEN"]
  args = "--only hosting"
}

Thanks for advice.

4 Likes

Can you share more details about how you’ve configured protected branches for the repository (maybe a screenshot of the settings)? If it’s sensitive, we can move this to support@github.com.

I have currently checks disabled but this is the checks status I get:

Since the action is only build and deploy on master branch (no check for pushing to branch like test etc.)

2 Likes

Is there any update on how you resolved this? I have the same problem. I created multiple workflows (one for every branch etc, one only for master and one only for develop). But when one of the workflows cancels (like when I push to develop, the workflow for master cancels), I get this red cross. Is there any possibility to ignore that and show a green check?

1 Like

Does it change if you push the  Build -step one up? My thought was just that then the workflow would have at least one step that is green before filter cancels.

This results in an overall failed check for me, too.

This issue in the actions repo deals about that. too.

Me too - details here: https://github.com/TypeStrong/ts-loader/pull/893

Didn’t find a way how to fix this. So for now I have to live with it like this. We have not set checks as mandatory in the repo so we can merge even with faild checks, but it is still annoying.

I did try different order of the actions in the flow but with no result. It always shows checks as failed. 

1 Like

Thanks for providing that additional information, so this behavior is expected but can see how it’s not ideal. We’re working on seeing how we can improve the situation.

1 Like

That’s currently the best workaround.

I played around a lot and found out this works a lot more like I expected if you place the filter as a “need” for the resolving action.

I modified the example workflow:

workflow "Deploy to Firebase" {
  on = "push"
  resolves = ["Deploy"]
}

action "On master branch" {
  uses = "actions/bin/filter@master"
  args = "branch master"
}

action "Build" {
  uses = "./.github/gatsby-build"
}

action "Deploy" {
  needs = ["Build", "On master branch"]
  uses = "webscopeio/firebase-deploy-github-action@master"
  secrets = ["FIREBASE_AUTH_TOKEN"]
  args = "--only hosting"
}

Now the PR checks are green and every action gets the status neutral.

@mcolyerI this like it should be done? Maybe some notes in doc would help.

2 Likes

I think I found the right spot. The filter hast to be a requirement for the resolving action.

Check my answer in this thread https://github.community/t5/GitHub-API-Development-and/Cancelled-Github-actions-fails-PR-checks/m-p/17464/highlight/true#M639

1 Like

I have tested your solution and it works so I accept it as a solution. Though donwside is that some steps are executed which may in the future expend limits for actions if there are one. Could be problematic for quite complicated workflow. Let’s hope GitHub folks will eventually fix this. 

I think this works well - after reading more about this issue I think I originally misunderstood. We’re still looking to improve this area, so we’re taking your feedback to heart.

1 Like

No I have almost the same problem again? Does anyone know how to handle this?

https://github.community/t5/GitHub-API-Development-and/GitHub-Actions-A-Neutral-Status-In-One-Action-Cancels-All/td-p/19189

Doesn’t this then only run the build on the master branch?

I am having the issue as I have the workflow of:

  • Build

  • Test

  • Is master

  • Deploy

In code:

workflow "BTMD" {
  on = "push"
  resolves = ["Deploy"]
}

action "Build" {
  # blah
}

action "Test" {
  # blah
  needs = ["Build"]
}

action "Master" {
  # blah
  needs = ["Test"]
}

action "Deploy" {
  # blah
  needs = ["Master"]
}

The problem with this is when Master failes - the PR fails.

If we make Master and Test the needs of Deploy, if Master fails, Test doesn’t run., which we need it to to make sure the branch is good to merge…