Skip to content

Incorrect context paths in conteiner #965

Closed

Description

@rosik

Describe the bug

The context is filled wrong when a job runs inside container:

  • ${{ runner.temp }}
  • ${{ runner.tool_cache }}
  • ${{ github.action_path }}

All these variables report a path without respect to the docker environment.

To Reproduce

Here is the repo with a reproducer: https://github.com/rosik/ga-test-public/

jobs:
  bug-in-container:
    runs-on: ubuntu-20.04
    container:
      image: centos:7
    steps:
      - uses: actions/checkout@v2
      - uses: ./.github/actions/repro # prints ${{ github.action_path }}

      - run: echo runner.temp = ${{ runner.temp }}
      - run: ls -al ${{ runner.temp }} || true

      - run: echo runner.tool_cache = ${{ runner.tool_cache }}
      - run: ls -al ${{ runner.tool_cache }} || true

Actual output

image

Expected behavior

From logs, we can see the docker container is created as

 /usr/bin/docker create
 --name f5a8984beffb4a899f1f2715bfce01bf_centos7_c77d38
 --label 442333
 --workdir /__w/ga-test-public/ga-test-public
 --network github_network_7a20e69633be4acaaa53ae9145c97812 
 -e "HOME=/github/home"
 -e GITHUB_ACTIONS=true
 -e CI=true
 -v "/var/run/docker.sock":"/var/run/docker.sock"
 -v "/home/runner/work":"/__w"
 -v "/home/runner/runners/2.276.1/externals":"/__e":ro
 -v "/home/runner/work/_temp":"/__w/_temp"
 -v "/home/runner/work/_actions":"/__w/_actions"
 -v "/opt/hostedtoolcache":"/__t"
 -v "/home/runner/work/_temp/_github_home":"/github/home"
 -v "/home/runner/work/_temp/_github_workflow":"/github/workflow"
 --entrypoint "tail" centos:7 "-f" "/dev/null"

So I expect variables to be:

  • runner.temp == "/__w/_temp"
  • runner.tool_cache == "/__t"
  • github.action_path == "/__w/ga-test-public/ga-test-public/./.github/actions/repro"

Runner Version and Platform

Current runner version: '2.276.1'
Operating System
  Ubuntu
  20.04.2
  LTS
Virtual Environment
  Environment: ubuntu-20.04
  Version: 20210131.1
  Included Software: https://github.com/actions/virtual-environments/blob/ubuntu20/20210131.1/images/linux/Ubuntu2004-README.md

Activity

  1. added
    bug
    on Feb 4, 2021
  2. rosik commented on Feb 4, 2021

    @rosik
    Author

    Extends #716

  3. self-assigned this
    on Mar 25, 2022
  4. nikola-jokic commented on Apr 4, 2022

    @nikola-jokic
    Contributor

    Hi @rosik,

    There is a PR fixing this issue, and as you noted. I will close this issue now but thank you for providing a repro repository. I am leaving a screenshot as a preview to prove that the fix is working as intended. Thank you for submitting it. I would normally wait for the PR to be merged, but since we have a previous issue stating this, and you already mentioned it, it seems alright to me to close this one. We can find it easily if something is wrong.
    image

    Please, if you see any issue with this screenshot that I haven't seen, don't hesitate to notify me 😊

  5. rosik commented on Apr 4, 2022

    @rosik
    Author

    Yea, this is fine. And thanks for the fix!

  6. ncfavier commented on Aug 30, 2022

    @ncfavier

    It seems like runner.temp is handled inconsistently with containers, see actions/upload-pages-artifact#20 (comment).

  7. added 5 commits that reference this issue on Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugneeds-investigation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions