-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Describe the bug
If an action from a repository is run then the GITHUB_ACTION_REPOSITORY and GITHUB_ACTION_REF environment variables are set. They were introduced in #585. However these variables are not un-set after the action run finishes and are available to future steps.
The specific case this caused a problem for me is my action may be run from a repository by outside users, but when testing locally we run the in-repo copy. Thus these two variables are not set explicitly for our run of the action (because it being run locally and not from a remote repository) and hence the variables retain their previous values (which for me happened to be from actions/checkout@v2). This is confusing as the action may blindly use these variables with incorrect values and think it's called something else.
To Reproduce
Run the following workflow:
name: Demo
on:
push:
jobs:
demo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
echo $GITHUB_ACTION_REPOSITORY
echo $GITHUB_ACTION_REFand it will output
actions/checkout
v2
Demo repo at https://github.com/robertbrignull/action_repository_demo/blob/main/.github/workflows/blank.yml
Expected behavior
I would expect those variables to no longer be set because the actions/checkout@v2 action has finished executing.