Skip to content

github.action_path contains wrong path when used inside a container #2185

Open

Description

@WIStudent

Describe the bug
When using ${{ github.action_path }} inside a local composite action and calling this action in a job that runs inside a container, ${{ github.action_path }} gets resolved to /home/runner/work/ga-test-public/ga-test-public/./.github/actions/repro instead of /__w/ga-test-public/ga-test-public/./.github/actions/repro.

There are other closed issues describing the same problem (#716, #965) and a merged pull request (#1762) that should have fixed the issue, but I am still getting the wrong path on GitHub shared runners with version 2.297.0

To Reproduce
Here is a reproduction repo and a workflow run with the mentioned issue.

# .github/workflow/test.yml
name: Reploduce the bug

on: 
  push: {}
  workflow_dispatch: {}

jobs:
  bug-in-container:
    runs-on: ubuntu-20.04
    container:
      image: centos:7
    steps:
      - uses: actions/checkout@v2
      - uses: ./.github/actions/repro

      - 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
# .github/actions/repo/action.yml
name: 'Reproduce the bug'
description: ''
inputs: {}
runs:
  using: 'composite'
  steps:
    - shell: bash
      run: |
        echo github.action_path: ${{ github.action_path }}
        ls -al ${{ github.action_path }} || true

Expected behavior
${{ github.action_path }} should be resolved to a path inside the container, not to a path on the host machine.

Runner Version and Platform

GitHub shared runner version 2.297.0

What's not working?

grafik

Activity

  1. added
    bug
    on Oct 6, 2022
  2. nikola-jokic commented on Oct 7, 2022

    @nikola-jokic
    Contributor

    Hey @WIStudent,

    Thank you for reporting this! We are aware of this issue. The PR #1762 solved this issue, but there was a problem with hash files, executing from a host machine. We are still exploring the best way to achieve this. I will post an update here about the progress regarding this issue.

  3. added
    Runner Bug
    on Oct 7, 2022
  4. added
    keep
    on Jan 11, 2023
  5. added
    triaged
    on Jan 11, 2023
  6. abhijeetdhoke commented on May 20, 2023

    @abhijeetdhoke

    What is end result in .yml file how to implement this change to .yml file

  7. MSAdministrator commented on Jun 7, 2023

    @MSAdministrator

    Has there been any updates to this issue? This is blocking some internal workflows.

  8. nikola-jokic commented on Jun 7, 2023

    @nikola-jokic
    Contributor

    Hey @MSAdministrator,

    This PR is in review and as soon as it is in, and the feature flag is on, then it should be okay.
    Until then, can you try passing actions_path as an env. Env variables are translated so container paths so it should be okay if you can use it ☺️

  9. MSAdministrator commented on Jun 7, 2023

    @MSAdministrator

    I was able to get it by just replacing the string using python

    - name: Setup Path
          shell: bash
          run: |
            PROJ_NEW_PATH=$(python -c "print('${{github.action_path}}'.replace('./.', '.'))")
            echo "PROJ_NEW_PATH=$PROJ_NEW_PATH" >> $GITHUB_ENV
    
  10. azlam-abdulsalam commented on Jun 28, 2023

    @azlam-abdulsalam

    @nikola-jokic any updates on this issue?

  11. nikola-jokic commented on Jul 3, 2023

    @nikola-jokic
    Contributor

    We merged the PR so the next release should have this functionality ☺️ . We also have a feature flag in case something goes wrong

  12. 22 remaining items

  13. added 3 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

Runner Bugbugkeeptriaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions