Actions: Variable substitution in commented lines
See original GitHub issueIf there are any variables in the commented lines get substituted in the logs of action workflow.
To Reproduce Steps to reproduce the behavior:
- Write Any simple action work flow
- In a job write following step
- name: Build App
run: |
#cd ${{ github.workspace }}
- Navigate to the logs of the step and expand the command. You can see the following
#cd /home/user/actions-runner/_work/cd-demo-app/cd-demo-app
Screenshot:
Expected behavior As the line was commented, it is expected not to substitute the variable. But the variable is getting substituted in the logs as shown in the snapshot
Runner Version and Platform
Runner version - 2.279.0 Running on Linux - x64
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to replace string in expression with GitHub actions
Work perfectly. Even as a one liner: run: echo "TOXENV=${BRANCH/\//-}" >> $GITHUB_ENV . Changes slashes into dashes. – Marcel Melzig.
Read more >Variable Substitution in Dockerfile : r/docker
Hey I'm trying to create a dockerfile with the following lines, however it doesn't look like the variable is substituted.
Read more >Basic Variable Substitution Examples
This topic covers a few basic scenarios for using variable substitution for Moogsoft Enterprise Workflow Engine function parameters.
Read more >Visual Studio Code Variables Reference
Variables Reference. Visual Studio Code supports variable substitution in Debugging and Task configuration files as well as some select settings.
Read more >Substituting variable values | Cloud Build Documentation
Substitutions are helpful for variables whose value isn't known until build time, or to re-use an existing build request with different variable values....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The runner doesn’t know it’s a comment for a given shell. The runner treat all inputs as string.
@girishenoy2003
${{ github.workspace }}
is not a variable, it’s an expression syntax for GitHub Actions, it will get evaluated and expanded before executing any script. https://docs.github.com/en/actions/learn-github-actions/expressions#about-expressions