Replace Hard-coded Paths with Already Existing Variable
See original GitHub issueProblematic
At the end of the YAML for the continuous integration example, the upload-artifact step path uses a hard coded folder path:
Recommended
I believe this should be using the Wap_Project_Directory variable plus “AppPackages” subfolder instead.
Snippet
# Upload the MSIX package: https://github.com/marketplace/actions/upload-artifact
- name: Upload build artifacts
uses: actions/upload-artifact@v1
with:
name: MSIX Package
path: '$env:Wap_Project_Directory\AppPackages\'
[Edit] - Added the subfolder name to the variable. I’m not sure that’s how to concatenate the variable with a string in GitHub actions yet, but you get the point
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Can you use environment variables to replace hardcoded ...
I am probably going to use GAC for what I need to get done but I was wondering if using environment variables in...
Read more >override hardcoded paths in executables
I'd like to override some hardcoded paths stored in pre-compiled executables like "/usr/share/nmap/" and redirect them to another dir. My ideal ...
Read more >Using Path Variables in a DIM
A general advantage of using path variables instead of hard-coded paths is that if the source files are moved to a different directory...
Read more >Hardcoded
Hard coded (not hardcorded) means that actual values that the user cannot change are used in the code rather than variables that can...
Read more >Hard coding
Hard coding (also hard-coding or hardcoding) is the software development practice of embedding data directly into the source code of a program or...
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 Free
Top 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

Since you already need the matrix variable for channel name, it wouldn’t be too much fluff to add another variable. However, the who point of a variable is that it’s value is different, so it defeats the purpose to have the same value in each matrix.
So instead, you could just add a comment where things are hard-coded. For example:
That way, developers who might clone/copy from this repo wont get hung up on a path that doesn’t exist in their app (you know folks are going to copy/paste without drilling deeper into each value).