Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GITHUB_WORKSPACE and github.workspace are different when running in container #785

Closed
nkakouros opened this issue Apr 26, 2022 · 7 comments

Comments

@nkakouros
Copy link

When using a container to run the checkout, the variables ${{ GITHUB_WORKSPACE }} and ${{ github.workspace }} are different.

---

name: CI

on:  # yamllint disable-line rule:truthy
  push:
    branches:
      - master
  pull_request:
    branches:
      - master

  workflow_dispatch: ~

jobs:
  test:
    runs-on: ubuntu-latest
    container:
      image: ubuntu:latest
    steps:
      - uses: actions/checkout@v3
      - run: |
          echo ${{ github.workspace }}
          echo $GITHUB_WORKSPACE

The documentation for github.workspace says:

The default working directory on the runner for steps, and the default location of your repository when using the checkout action.

The documentation for GITHUB_WORKSPACE says:

The default working directory on the runner for steps, and the default location of your repository when using the checkout action.

I believe they should be set to the same value.

@alexprogrammr
Copy link

I'm facing the same issue using containers.

$ echo ${{ github.workspace }}
/home/runner/work/<REPO_NAME>/<REPO_NAME>

$ echo $GITHUB_WORKSPACE
/__w/<REPO_NAME>/<REPO_NAME>

where <REPO_NAME> is the repository name where workflow is running.

@spikeburton
Copy link

Interesting observation -

- run: |
    echo ${{ github.workspace }}

    MY_WORK_DIR=${{ github.workspace }}
    echo "MY_WORK_DIR=$MY_WORK_DIR" >> $GITHUB_ENV
- run: |
    echo $MY_WORK_DIR

Output:

+ echo ${{ github.workspace }}
/opt/actions-runner/_work/<REPO_NAME>/<REPO_NAME>

+ echo $MY_WORK_DIR
/__w/<REPO_NAME>/<REPO_NAME>

@ZachOldham
Copy link

I don't think this is a checkout specific bug actions/runner#2058

@nkakouros
Copy link
Author

Indeed, closing this and subscribing to the linked bug.

@abhijeetdhoke
Copy link

I am getting same issue can someone help me on this? its killing my time

@gitcos
Copy link

gitcos commented Sep 19, 2023

Indeed, closing this and subscribing to the linked bug.

What is "the linked bug"? You didn't link to another bug.

@mloskot
Copy link

mloskot commented Sep 19, 2023

I guess it was meant to be the bug linked by previous #785 (comment) that is this one actions/runner#2058

hkershaw-brown added a commit to hkershaw-brown/DART that referenced this issue Jun 12, 2024
pthierry-ledger added a commit to outpost-os/action-setup-compiler that referenced this issue Aug 2, 2024
pthierry-ledger added a commit to outpost-os/action-setup-compiler that referenced this issue Aug 2, 2024
daprilik added a commit to microsoft/openvmm that referenced this issue Oct 18, 2024
Very frustrating indeed... Running into
actions/checkout#785
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants