Skip to content

Silence SC1090 on the workflow steps that source '.env' #3080

Description

@AlexSkrypnyk

Summary

actionlint reports shellcheck SC1090 on every workflow step that sources .env, because the path is built at runtime and shellcheck cannot follow it. The sourcing is intentional, so the finding is noise - but it is noise on four steps across two workflows, which trains people to ignore actionlint output.

Details

The step appears once in .github/workflows/audit.yml and three times in .github/workflows/build-test-deploy.yml:

- name: Load environment variables from .env
  run: t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && env >> "$GITHUB_ENV"

actionlint reports:

shellcheck reported issue in this script: SC1090:warning:1:71:
ShellCheck can't follow non-constant source. Use a directive to specify location

Suggested change

Convert the run value to a block scalar so a directive can precede the command:

- name: Load environment variables from .env
  run: |
    # shellcheck source=/dev/null
    t=$(mktemp) && export -p >"${t}" && set -a && . ./.env && set +a && . "${t}" && env >> "$GITHUB_ENV"

Applying it to all four occurrences keeps the two workflows consistent - fixing only the one an automated reviewer happens to flag leaves them divergent.

How this surfaced

Raised by an automated review on a consumer project's 1.41.0 update PR. Applied there to all four steps, and worth carrying upstream so other consumers do not each patch their own copy.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    • Status
      Release queue

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions