actions / actions/runner-container-hooks

[bug] Environment variable parsing is inconsistent. ${{ github.action_path }} is different than $GITHUB_ACTION_PATH in `env.GITHUB_ACTION_PATH=${{ github.action_path }}`

Open
#417 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
153
Forks
112
Avg merge
6m
Merged PRs (30d)
1

Description

The environment variables are parsed differently on the steps than they are inside the script, because the exec step inherits the environment from the parent

This is an excerpt of a run step inside a container I was testing

Essentially, when you use env.GITHUB_ACTION_PATH=${{ github.action_path }} you get a different result in the environment variable as if you used the ${{ github.action_path }} directly. I think this has to do with how the exec script is currently done and streamed. there might need to be some proxy to the variables to imrpote this

  steps:
    - shell: bash
      env:
        GITHUB_ACTION_PATH: ${{ github.action_path }}
        WORKSPACE: ${{ github.workspace }}
      run: |
        echo External ACTION PATH: GITHUB_ACTION_PATH="${GITHUB_ACTION_PATH}"
        echo ACTION PATH INSIDE SCRIPT: ${{ github.action_path }}

        echo External WORKSPACE: WORKSPACE="${WORKSPACE}"
        $ External ACTION PATH: GITHUB_ACTION_PATH=/__w/repo/repo/./actions/linter-configs
        $ ACTION PATH INSIDE SCRIPT: /home/runner/_work/repo/repo/./actions/linter-configs
        $ External WORKSPACE: WORKSPACE=/__w/repo/repo
        $ WORKSPACE INSIDE SCRIPT: /home/runner/_work/repo/repo

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the exec step inherits and streams its environment, then compare the env.GITHUB_ACTION_PATH and inline ${{ github.action_path }} paths in the container run-step example. Done means both forms produce the same path, including for GITHUB_WORKSPACE.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.