Github Actions variables point to fork parent

Viewed 590

I've forked a project:
enter image description here

and I'm setting up a CI definition on non master branches with these final steps:

- name: Zip the release
  uses: papeloto/action-zip@v1
  with:
    files: README.md LICENSE *.dll nfive.yml nfive.lock fxmanifest.lua index.html config/
    dest: ${{ github.workspace }}\nfive.zip

- name: Attach Zip as build artifact
  uses: actions/upload-artifact@v1
  with:
    name: nfive
    path: ${{ github.workspace }}\nfive.zip

Why does github.workspace point to the original repository NFive\NFive? enter image description here

So, if run echo ${{ github.workspace }} it definitely shows the parent repository, but to make this even more difficult if I change directory to my organisation name and forked repository name I get this:

enter image description here

which is the output of these steps:

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

- name: Move files to artifact folder
  shell: pwsh
  run: |
    cd D:\a\HTB-5M\NFive
    mkdir Build        
    Move-Item -Path README.md,LICENSE,*.dll,nfive.yml,nfive.lock,fxmanifest.lua,index.html,config -Destination Build

I don't have access to the parent path because I'm not a contributor, which is why I forked in the first place, so why does Github assume github.workspace should map to the parent?

=== Udate ===

So I reforked to my user account rather than the organisation I used and added a workflow step to just display the github.workspace variable and it definitely says the parent workspace D:\a\NFive\NFive

enter image description here

I tried changing the path in the nfive.yml

enter image description here

Same outcome

enter image description here

Deleting the nfive.yml doesn't change anything. I think the nfive.yml is actually used in the CI / CD pipelines the original authors configured on appveyor so it isn't going to affect anything here.

1 Answers

It isn't pointing to the fork parent repo, it's because the github.workspace variable follows this format: /home/runner/work/my-repo-name/my-repo-name.

That's the reason why NFive appears twice, it's NOT refering to NFive username / organization, but twice to the NFive repository name.


This is explained on the github documentation about default environment variables

enter image description here

I forked the repository as well and I don't get any error when running this workflow.

Here is the workflow run output with the generated .zip file artifact.

Related