Comments (3)
Hello,
GitHub context variables are not mapped to shell variables (unless you set them as env variables).
GitHub workflow engine will instead do substitution before your shell command is executed.
You have to use ${{ <expression> }}
syntax instead of ${<expression>}
.
Next things is what is actually output of this actions. For your example it would be:
{
"server": "true",
"server_files": "\"server/pricinf/main.go\" \"server/sendmain/packGreet/logic.go\"",
"changes": ["server"]
}
You wrote you are trying to get list of services which changed, but you can't get that directly out of this.
list-files
option is useful mostly when you want to pass list of changed files directly as argument to linter.
If your linter operates on a whole folder I would chose different approach.
You could have for example this filter:
with:
filters: |
pricing: 'server/pricing/**'
sendmail: 'server/sendmail/**'
Afterwards you have several options:
- use
if
conditions to selectively execute steps in service folders - use
${{ fromJson(needs.some-job.outputs.changes) }}
as parameter for matrix job - use
join(fromJson(steps.changes.outputs.changes), ' ')
to transformchanges
output in JSON format to be usable in shell for loop. This requires your service names to not contain any special character or whitespace.
For example the last options would look like this:
- name: Printing changed services
run: |
for val in ${{ join(fromJson(steps.changes.outputs.changes), ' ') }}; do echo $val; done
from paths-filter.
Hey @Kmelow, is your issue solved? Unless you have more issues/questions I will close this.
from paths-filter.
Hello @dorny,
Thanks for the suggestion on filters
above. The configuration is cleaner.
And I implemented a script using your suggested example and it is all good 👍
- name: Printing changed services
run: |
for val in ${{ join(fromJson(steps.changes.outputs.changes), ' ') }}; do echo $val; done
🙇 Thank you
from paths-filter.
Related Issues (20)
- Weird permission issue when tracking changes for new files HOT 1
- Pass matrix object array as filter HOT 1
- Use filter header and name for matrix
- Output of job with paths-filter not being passed to dependent job HOT 1
- set-output deprecation warning HOT 1
- Document usage in a merge queue
- How to get intuitive usage when mixing file paths and ignore paths? HOT 3
- Changes are compared against incorrect branch HOT 1
- How to use exclude function HOT 3
- How to use paths-filter in reusable github action workflows HOT 5
- dorny/paths-filter@v2 filter condition returns false with Matching files: none
- Passing output from Githubaction to Terragrunt Githubaction
- Import filters file from another repository HOT 1
- Bug: Filter Action reading files from wrong PR HOT 2
- Feature request: Only perform a checkout when it is required for paths-filter to operate.
- [Feature request] Return as changed array HOT 1
- Exclude few folders in one filter HOT 3
- Detecting changes against main branch on main branch merge? HOT 2
- Become 'Verified creator' on GitHub Marketplace HOT 3
- Token clarification
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paths-filter.