loop through list of files #25952
-
how would i loop through a list of files and run a workflow on each file?
on the scss files i must run one workflow that compiles them into css, and the one that prettifies them. and on the prettify files i just have to run the prettifier workflow. How would i loop through an array and pass it to a workflow so i can reference it with something like:
|
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
You could set them as environment variables and use shell commands to loop over them, e.g. (Linux shell syntax, might be different on other platforms):
Though I think it might be better to use a build tool (e.g. make or whatever else suits your project) for this, or to add a script to your repository that does the processing based on parameters or even automatically discovered input. |
Beta Was this translation helpful? Give feedback.
-
I’m not sure how you compile the scss files into css, but ‘jobs.<job_id>.strategy.matrix’ could be an option for you. |
Beta Was this translation helpful? Give feedback.
-
im using:
to build it |
Beta Was this translation helpful? Give feedback.
-
using this, how would i call a github action using a consle command? |
Beta Was this translation helpful? Give feedback.
-
Hi @vortetty , action ‘gha-utilities/sass-build’ has defined inputs ‘source’ and ‘destination’, you can use matrix value for them. Code sample as below:
It will complie the two scss files seperately into css folder. Hope it helps. |
Beta Was this translation helpful? Give feedback.
-
Perfect, thank you! |
Beta Was this translation helpful? Give feedback.
-
what language it is for “for” loop? |
Beta Was this translation helpful? Give feedback.
-
airtower-luna:
I guess you mean this? That’s sh (Unix/Linux shell). By default |
Beta Was this translation helpful? Give feedback.
Hi @vortetty ,
action ‘gha-utilities/sass-build’ has defined inputs ‘source’ and ‘destination’, you can use matrix value for them.
Code sample as below:
It will complie the two scss files seperately into css folder. Hope it helps.