-
Notifications
You must be signed in to change notification settings - Fork 1.1k
shell in step/defaults cannot use job/matrix templates #444
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
Comments
Shell is mean to set to ‘cmd’ ‘bash’ ‘sh’ and ‘powershell’
|
Per docs:
So I'm defining custom shell and its options (as documented). I really don't see a reason for "run" accepting expressions and "shell" not. |
@chrispat for whether we allow expression in script's |
I don't see any reason not to. The only reason we don't allow it is |
@chrispat any update? I want to run Powershell test/builds in matrix and right now I have two very redundant tasks with an if expression gating them. |
Hi @JustinGrote, While reproducing this issue, I noticed that shell expression would work now. Could you please tell me if you are still experiencing this issue? If you do, could you provide an example repository so I can reproduce this behaviour with your workflow, so I don't miss anything? |
Using the originally given example still seems to fail for me with Full repo: https://github.com/oplik0/github-actions-shell-variables-test Looking at files mentioned in the original post nothing seems to have changed there. The workflow I wanted to use this in (matrix for testing with different shells) also still doesn't seem to work, returning the same error. Edit: added a quick example of my desired usage with matrix: https://github.com/oplik0/github-actions-shell-variables-test/blob/main/.github/workflows/matrix-example.yml - obviously also fails with same error: https://github.com/oplik0/github-actions-shell-variables-test/actions/runs/1819103791/workflow |
Thank you for providing an example @oplik0! I added this issue to the feature board. |
Another example where expressions could be useful in I tried to use custom shell with GitHub actions, and installed in previous step. But I can not reference the absolute path with:
|
Adding a simple `git config...` command toppled the house of cards it was. Multiple changes were requried to make Cygwin actions work again while remaining somewhat readable and editable. Here are some highlights in no particular order: * Cygwin scripts now use custom shell in GitHub Actions. This is the proper way, but `shell:` definitions do not support contexts yet [1][2], so we have to resort to hardcoding CYGWIN_ROOT path everywhere. [1]: actions/runner#444 [2]: https://docs.github.com/en/actions/learn-github-actions/contexts * $HOME directory is now created in Cygwin for writing ~/.gitconfig * $PATH definition must happen within Cygwin scripts and not in Actions config, because otherwise GitHub runner tries to be helpful and translates non-Windows $PATH to gibberish * GitHub actions save custom scripts with CRLF delimiters, this is Windows after all. Bash does not support CRLF by default, so we need SHELLOPTS now * Reformat Cygwin packages list while we're at it
I modifiy the example workflow https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#example-expanding-configurations
|
shell
parameter insteps
context should allow ${{ job/steps. }} variables.I can see no reason for disallowing such expressions there.
To Reproduce
https://github.com/jacekkow/github-actions-bugs/blob/master/.github/workflows/bug1.yml
Expected behavior
Step returns:
Runner Version and Platform
GitHub Actions
What's not working?
The workflow fails:
As far as I can tell this is due to
non-empty-string
being used instead ofstring-steps-context
(or perhaps newnon-empty-string-steps-context
?) here:runner/src/Sdk/DTPipelines/workflow-v1.0.json
Line 403 in 3d70ef2
Similar change should also be made here:
runner/src/Sdk/DTPipelines/workflow-v1.0.json
Line 422 in 3d70ef2
The text was updated successfully, but these errors were encountered: