Skip to content

Docs on expressions with extra conditions not clear #18269

Closed
@alexbrazier

Description

@alexbrazier

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/learn-github-actions/expressions#failure

What part(s) of the article would you like to see updated?

The docs mention how to use failure() to catch failing jobs and then goes on to say it's the same as job.status == 'failure' or github.action_status == 'failure', however from my testing this isn't true.

Using either of the above fail to run after a failing job, e.g.

steps:
  - name: Fail demo
     run: exit 1
  - name: The job has failed
    if: ${{ job.status == 'failure' }}

The docs suggest The job has failed is meant to run here, but from my testing it doesn't. Not sure if this is a bug with github actions or the docs are just wrong or if I'm just missing something.

I think these broken examples should be removed and a practical example showing how to catch a specific failing job rather than all jobs would be useful here.

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionsThis issue or pull request should be reviewed by the docs actions teamcontentThis issue or pull request belongs to the Docs Content team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions