question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Actions: Variable substitution in commented lines

See original GitHub issue

If there are any variables in the commented lines get substituted in the logs of action workflow.

To Reproduce Steps to reproduce the behavior:

  1. Write Any simple action work flow
  2. In a job write following step
 - name: Build App
    run: |
          #cd ${{ github.workspace }}
  1. 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: image

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:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TingluoHuangcommented, Nov 16, 2021

The runner doesn’t know it’s a comment for a given shell. The runner treat all inputs as string.

1reaction
TingluoHuangcommented, Nov 15, 2021

@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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found