Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg/runner: add support to replace GitHub's env #1197

Merged
merged 1 commit into from
Jun 8, 2022

Conversation

aanm
Copy link
Contributor

@aanm aanm commented Jun 3, 2022

There might be use cases where users want to use GitHub's variables in
the environment variables, which is a valid use case.

This commits adds support for replacement of GitHub's env with GitHub's
values.

Signed-off-by: André Martins aanm90@gmail.com

Fixes: #1195

@aanm aanm requested a review from a team as a code owner June 3, 2022 14:35
@codecov
Copy link

codecov bot commented Jun 3, 2022

Codecov Report

Merging #1197 (cebba33) into master (4f8da0a) will increase coverage by 4.79%.
The diff coverage is 78.55%.

@@            Coverage Diff             @@
##           master    #1197      +/-   ##
==========================================
+ Coverage   57.50%   62.30%   +4.79%     
==========================================
  Files          32       40       +8     
  Lines        4594     5332     +738     
==========================================
+ Hits         2642     3322     +680     
- Misses       1729     1744      +15     
- Partials      223      266      +43     
Impacted Files Coverage Δ
pkg/model/action.go 0.00% <0.00%> (ø)
pkg/model/github_context.go 79.51% <ø> (ø)
pkg/model/planner.go 50.73% <ø> (+0.32%) ⬆️
pkg/model/step_result.go 0.00% <ø> (ø)
pkg/model/workflow.go 54.29% <0.00%> (+3.38%) ⬆️
pkg/container/docker_run.go 15.00% <26.82%> (+9.45%) ⬆️
pkg/common/git.go 49.31% <28.57%> (-0.52%) ⬇️
pkg/container/file_collector.go 44.85% <44.85%> (ø)
pkg/exprparser/interpreter.go 73.37% <53.48%> (-0.02%) ⬇️
pkg/runner/runner.go 71.31% <68.18%> (-5.16%) ⬇️
... and 24 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

pkg/runner/expression.go Outdated Show resolved Hide resolved
@mergify mergify bot requested a review from a team June 7, 2022 12:53
There might be use cases where users want to use GitHub's variables in
the environment variables, which is a valid use case.

This commits adds support for replacement of GitHub's env with GitHub's
values.

Signed-off-by: André Martins <aanm90@gmail.com>
Copy link
Contributor

@ChristopherHX ChristopherHX left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I can confirm this works. Also with multiple expressions in a global env.

- name: print env.variable
run: |
echo ${{ env.variable }}
exit ${{ (env.variable == 'nektos') && '0' || '1'}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test will fail in forks of act outside of the nektos org, maybe use a different context value like github.event_name. I still approve this change as is.

Copy link
Contributor

@cplee cplee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

@mergify mergify bot merged commit bf4aad6 into nektos:master Jun 8, 2022
@aanm aanm deleted the github-env-support branch June 8, 2022 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to use a github environment variables on "env"
4 participants