Skip to content

Workflow job execution doc should clarify that 'env' context is not available in job 'if' conditional #21927

Description

@neilotoole

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution

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

The doc has an example:

name: example-workflow
on: [push]
jobs:
  production-deploy:
    if: github.repository == 'octo-org/octo-repo-prod'

I spent several hours trying to access env.MY_ENVAR, running into errors, before finally realizing that the env context cannot be accessed until after the job runner has been instantiated (which happens after the if guard has passed).

The doc should be updated to clarify that the env context is not available in the if conditional of a job.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    MLH fellowshipThis issue is reserved for the MLH Fellowship programactionsThis 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

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions