Fix logic for determining when to simulate GitHub Actions environment #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables fixes a few quirks where mimicking a GitHub environment didn't correctly work, if the graph was started from a browser session. This also changed the way which env vars are respected from which source.
GITHUB_TOKEN
opts.OverrideSecrets["GITHUB_TOKEN"](highest)opts.OverrideEnv["GITHUB_TOKEN"]os.Getenv("GITHUB_TOKEN")os.Getenv("INPUT_TOKEN")(lowest)GITHUB_ACTIONS
opts.OverrideEnv["GITHUB_ACTIONS"]os.Getenv("GITHUB_ACTIONS")core/gh-start@v1(implicit)GITHUB_WORKSPACE
opts.OverrideEnv["GITHUB_WORKSPACE"]os.Getenv("GITHUB_WORKSPACE")Mimic GitHub Environment Detection
So when running outside of a real GitHub Actions runner, the system checks if it needs to simulate a GitHub environment. This happens when two things are true.
isGitHubActionsis true if either defined in the config panel of the app editor, or defined via.envor shell var (ignored if defined in a config file).GITHUB_RUN_IDRUNNER_TEMPGITHUB_API_URLGITHUB_RETENTION_DAYS