I'm new to github actions.
Below is my workflow:
name: Example
on: [push, workflow_dispatch]
env:
APPNAME: 'myapp1'
APPURL: "https://mybank/$APPNAME/widgets/hello.json"
jobs:
test:
runs-on: windows-latest
steps:
- name: Print variables
run: |
echo "APPURL is: ${{ env.APPURL }}"
Output:
Run echo "APPURL is: https://mybank/$APPNAME/widgets/hello.json"
APPURL is: https://mybank//widgets/hello.json
I understand that env. cannot be used under at workflow level.
Is it possible to have variable interpolation APPNAME at workflow level i.e for APPURL?
This is due to the
windows-latestrunner usingpowershellby default to run command lines.In that case, informing the
shell: bashwill work.Note that using the
ubuntu-latestormacos-latestrunners will work as well without informing the shell, as they usebashas default.I've made an example here using this workflow implementation with another example for concatenation that can be useful depending on what you want to achieve.