actions / actions/runner

github.action_path contains wrong path when used inside a container

Open
#2,185 10 comments 22 reactions 1 assignee View on GitHub

Nobody has claimed this yet.

bug keep Runner Bug triaged
Dominant language
C#
Stars
6.3k
Forks
1.4k
Avg merge
1d 16h
Merged PRs (30d)
24

Description

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 (https://github.com/actions/runner/issues/716, https://github.com/actions/runner/issues/965) and a merged pull request (https://github.com/actions/runner/pull/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

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.