Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 1 of 8

[Github Actions] Contexts and steps if conditionals are unusable with incomplete docs

Solved! Go to Solution.

When I echo the context for `steps` as mentioned in the docs i get `{}` and `job` just has two fields. 

 

GitHub Actions Contexts:

https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#contexts

 

Status check functions:

https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#status-check-f...

 

In the workflow syntax it is clear that `failure` should have been `failure()`

https://help.github.com/en/articles/workflow-syntax-for-github-actions#example-using-status-check-fu...

 

Currently selecting on which `step`'s success/failure should another step be triggered is not working it seems.

 

i.e

steps:
name: my first step
if: job.steps.<step id>.status == failure

^ the above snippet from the doc is not working.

7 Replies
Community Manager
Message 2 of 8

Re: [Github Actions] Contexts and steps if conditionals are unusable with incomplete docs

Hey @geekodour,

 

Thanks again for taking the time to report this, we are working on it internally and I'll post an update here as soon as I have news.

 

Thanks again. Meanwhile, we're looking forward to seeing you around!


Best,
AndreaG

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Copilot Lvl 3
Message 3 of 8

Re: [Github Actions] Contexts and steps if conditionals are unusable with incomplete docs

Just to be even more clear about my question, I think `job.steps.<step_id>.status` does not exist yet. as job context is just

{
  "status": "Success"
}

and steps context is just {}

 

Copilot Lvl 2
Message 4 of 8

Re: [Github Actions] Contexts and steps if conditionals are unusable with incomplete docs

@AndreaGriffiths11 any update on this?  

 

While i understand that the product is still in beta, I think it is more useful to only release docs for api/endpoints that work; not things that we hope will work in the future.

 

Time is my most valuable asset and it is really frustrating to invest time using/learning a new product only to learn that particular endpoint isn't working "YET" and no clear instructions on alternatives to use in the meantime.

 

Copilot Lvl 3
Message 5 of 8

Re: [Github Actions] Contexts and steps if conditionals are unusable with incomplete docs

Try

if: job.steps.<step id>.status == failure()

 

Ground Controller Lvl 1
Message 6 of 8

Re: [Github Actions] Contexts and steps if conditionals are unusable with incomplete docs

It doesn't work either way because job.steps.<step id>.status is null. job is the following simple object:

{
    "status": "Success"
}

As you can see, it doesn't even have a steps property, let alone anything below that.

Copilot Lvl 3
Message 7 of 8

Re: [Github Actions] Contexts and steps if conditionals are unusable with incomplete docs

Since I'm finding many parts of the docs are still more like a whishlist, I'm starting this repo, that tracks progress of the missing features: https://github.com/meeDamian/github-actions-bugs/actions, I'll be adding one feature check, per scheduled daily workflow file.  Feel free to contribute, or peek-in to see if it's already implemented :).

Solution
GitHub Staff
Message 8 of 8

Re: [Github Actions] Contexts and steps if conditionals are unusable with incomplete docs

That is a bug in the docs that I have opened a PR for.  You can't compare the status of an individual step, you can just check the status of the entire job to that point.  The built in status functions in that doc compare against the overall job status.