taichi / actions-package-update

keeps npm dependencies up-to-date by making pull requests from GitHub Actions or CI.
64 stars 14 forks source link

GitHub ignores GITHUB_WORKSPACE env variable #9

Closed nicole-ashley closed 4 years ago

nicole-ashley commented 4 years ago

No matter how you set this variable in a GitHub action, it's ignored (or possibly overwritten by GitHub). This means you can't run actions-package-update in any folder other than the root.

You can verify this by creating a workflow step:

- name: Attempt to set GITHUB_WORKSPACE
  env:
    FOO: bar
    GITHUB_WORKSPACE: ./foo
  run: printenv

Observe that the output shows that the GITHUB_WORKSPACE variable has not been changed:

Run printenv
  printenv
  shell: /bin/bash -e {0}
  env:
    FOO: bar
    GITHUB_WORKSPACE: ./foo
# ...
FOO=bar
# ...
GITHUB_WORKSPACE=/home/runner/work/actions-package-update/actions-package-update

This is also the case if you use set-env, because all that does is create an env property for future steps as if you had put them into the workflow yourself.

To solve this you would need to create a different environment variable that we can use which GitHub will not ignore or clobber (WORKING_DIRECTORY maybe?).

nicole-ashley commented 4 years ago

@taichi Any thoughts on this? As you're using an NPM module it's not something I can just fork and use myself - it needs to be fixed in the core. I've submitted a PR to fix it which just needs your approval.

nicole-ashley commented 4 years ago

Awesome, thank you!