Skip to content

EmptyStepEnv

Step has empty env.

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

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 examples

Non-compliant example #1

Empty env on step.

example.yml

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

  • Line 6: Step[#0] in Job[example] should not have empty env.

Non-compliant example #2

Empty env on composite step.

action.yml

name: ""
description: ""
runs:
  using: composite
  steps:
    - shell: bash
      run: echo "Example"
      env: {}

  • Line 6: Step[#0] in Action[""] should not have empty env.