jenseng / dynamic-uses Goto Github PK
View Code? Open in Web Editor NEWDynamically resolve and use another GitHub action
License: ISC License
Dynamically resolve and use another GitHub action
License: ISC License
Given
- uses: jenseng/dynamic-uses@v1
with:
uses: actions/setup-node@${{ steps.branch-name.outputs.current_branch }}
with: '{ "node-version": 18 }'
env:
environment_variable: test
I don't believe env
would be passed down into the dynamically created uses, this would be pretty integral to have as a feature
Hi great work i really like the idea. The current problem i facing is to pass down a secret that contains a multiline string like a SSH Private Key for example.
Do you have any idea how to escape it properly so that i can be passed in the with block.
Hello @jenseng ๐,
Just wanted to say thank you for this work, I have a use case where my next composite action cannot process JSON
. I came up with this workaround/hack and wanted to share. Given the way this works already I'm not sure you could incorporate the change without breaking existing users. I'd be happy to create a new action and attribute you if so, let me know if you have any preferences or feedback. Thank you again.
TL;DR - convert JSON
to a YAML
array for actions.
format_json() {
echo $1 | jq -r '
(
to_entries |
reduce .[] as $item (" ";
. + "\n \($item.key | ascii_upcase): '\''\($item.value)'\''"
)
)'
}
export WITH=$(format_json '${{ inputs.with }}')
mkdir -p ./.tmp-dynamic-uses &&
cat << 'DYNAMIC_USES_EOF' | envsubst > ./.tmp-dynamic-uses/action.yml
outputs:
outputs:
value: ${{ '$' }}{{ toJSON(steps.run.outputs) }}
runs:
using: composite
steps:
- name: Run
id: run
uses: ${{ inputs.uses }}
with: ${WITH}
DYNAMIC_USES_EOF
With uses keyword, secrets can be passed by either providing key-values to secrets
or passing down all secrets using secrets: inherit
. Would it be possible with this github action? That might help prevent a lot of things needed to do for passing something like token or a client_secret or something.
This is an awesome action. Can you please add an official license for use/share/modifications as github defaults to the most strict licensing policy if none provided?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.