How to remove an environment variable on GitHub actions?

Viewed 1417

Context

On https://docs.github.com/en/actions/learn-github-actions/environment-variables they describe a way to add an environment variable with yaml:

jobs:
  job_name:
    env:
      NAME: value

On https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions/#setting-an-environment-variable linked from the same place, shows how to add an environment variable from script steps:

echo "NAME=value" >> $GITHUB_ENV

Question

I'm looking for a way to do the opposite: given that an env var was added with one of the above options, fully remove it so that subsequent job steps don't see it either.

I tried

echo "NAME=" >> $GITHUB_ENV

but it just sets it to empty string, I need it gone so that env doesn't list it any more.

Resources

Raised it GitHub community too: https://github.community/t/remove-environment-variable-from-job/214815

0 Answers
Related