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_REF
and it will output
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.
Describe the bug
If an action from a repository is run then the
GITHUB_ACTION_REPOSITORYandGITHUB_ACTION_REFenvironment 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:
and it will output
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@v2action has finished executing.