Skip to content

EmptyWorkflowEnv

Workflow has empty env.

Defined by EmptyEnvRule which supports workflows, actions in the "Default" ruleset along with EmptyJobEnv, 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 workflow.

example.yml

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

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