Skip to content

DuplicateShellOnSteps

Multiple steps have the shell defined.

Defined by DuplicateShellRule which supports workflows in the "Default" ruleset.

Description

Multiple steps having a shell defined causes noise. Step shells should be uniform for each job, since each step is executed on the same runner.

Relevant documentation:

Compliant examples

Compliant example #1

Only one step has shell.

example.yml

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

Compliant example #2

Default shell is defined for the job.

example.yml

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

Compliant example #3

Shell is mandatory on every step in composite actions.

action.yml

name: Test
description: Test
runs:
  using: composite
  steps:
    - run: echo "Example"
      shell: bash
    - run: echo "Example"
      shell: bash

Non-compliant example

Multiple steps have shell.

example.yml

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

  • Line 3: Job[example] has all (2) steps defining bash shell, set default shell on job.