Skip to content

EmptyJobEnv

Job has empty env.

Defined by EmptyEnvRule which supports workflows, actions in the "Default" ruleset along with EmptyWorkflowEnv, EmptyStepEnv.

Description

Dead code can lead to confusion.

Empty environment variable listing is not necessary, that is the default. GitHub Actions treats empty env and missing env the same way, because the differently scoped env listings are additive.

Remove the env section, if it is empty.

Compliant example

No env defined.

example.yml

on: push
jobs:
  example:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Example"

Non-compliant example

Empty env on job.

example.yml

on: push
jobs:
  example:
    env: {}
    runs-on: ubuntu-latest
    steps:
      - run: echo "Example"

  • Line 3: Job[example] should not have empty env.