Skip to content

The GITHUB_WORKSPACE is set with an incorrect directory #711

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

Open
BrightRan opened this issue Sep 16, 2020 · 2 comments
Open

The GITHUB_WORKSPACE is set with an incorrect directory #711

BrightRan opened this issue Sep 16, 2020 · 2 comments
Labels
Runner Bug Bug fix scope to the runner

Comments

@BrightRan
Copy link

BrightRan commented Sep 16, 2020

Associated GitHub Community ticket: https://github.community/t/github-actions-is-setting-github-workspace-incorrectly/132187

The customer has a workflow like as below:

name: CI
env:
  JAVA_VERSION: 11.0.7
  NOW: $(($(date +%s%N)/1000000))
on:
  pull_request:
jobs:
  evaluate-environment:
    name: Look at the environment
    runs-on: [self-hosted, humio, special]
    steps:
      - name: Print github workspace
        run: |
          echo "GITHUB_WORKSPACE = $GITHUB_WORKSPACE"
          echo "github.workspace = ${{ github.workspace }}"
          echo "pr.ref = ${{github.event.pull_request.head.ref}}"
          echo "github.ref = ${{ github.ref }}"
          echo "$GITHUB_CONTEXT"
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}

  checkout-code:
    name: Check out the code and see what ref comes out
    runs-on: [self-hosted, humio, special]
    steps:
      - name: Remove existing git hooks
        run: git config --unset core.hooksPath && rm -rf .git/hooks/ || true

      - uses: actions/checkout@v2
        with:
          path: ${{ github.ref }}
          clean: true
          lfs: true

      - name: Checkout LFS
        run: git lfs checkout

      - name: Print workspace path
        run: echo $GITHUB_WORKSPACE && pwd && echo ${{github.ref}}

      - name: current checkout
        run: git log -10

When viewing the value of 'GITHUB_WORKSPACE' and 'github.workspace' printed in the logs, he found that the path was "/actions-runner/gh-ci-01/_work/humio/refs/pull/8401/merge".
Normally, the path of the default workspace should like as below:

<runner-installation-directory>/_work/<repo-name>/<repo-name>
OR
<runner-installation-directory>/work/<repo-name>/<repo-name>

In the customer's case, the correct path should be "/actions-runner/gh-ci-01/_work/humio/humio". But why the path was changed?

@BrightRan
Copy link
Author

BrightRan commented Sep 16, 2020

According to what has been mentioned in "actions/runner#702", it seems that the checkout action can change the path of the default workspace and cause error like "No such file or directory".
Is this problem also related to the issue of the checkout action?

@srdo
Copy link

srdo commented Sep 16, 2020

Just to make sure this is not missed: The path /actions-runner/gh-ci-01/_work/humio/refs/pull/8401/merge is mentioning pull request 8401, but the action is running as part of the workflow for pull request 8410. This seems wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Runner Bug Bug fix scope to the runner
Projects
None yet
Development

No branches or pull requests

3 participants