GitHub Action
You can use
yq
in your GitHub action, for instance: - uses: actions/[email protected]
- name: Get SDK Version from config
id: lookupSdkVersion
uses: mikefarah/[email protected]
with:
cmd: yq '.renutil.version' 'config.yml'
- name: Restore Cache
id: restore-cache
uses: actions/[email protected]
with:
path: ../renpy
key: ${{ runner.os }}-sdk-${{ steps.lookupSdkVersion.outputs.result }}
restore-keys: |
${{ runner.os }}-sdk
# ... more
The
yq
action sets a result
variable in its output, making it available to subsequent steps. In this case it's available as steps.lookupSdkVersion.outputs.result
.If you enable step debug logging, you can see additional information about the exact command sent as well as the response returned within the GitHub Action logs.
GitHub Actions escape and interpolate rules can conflict with some yq syntax. Here is an example of how to quote a variable that could contain dots in a query path (more usage context: ambanum/OpenTermsArchive#899).
- name: Get an entry with a variable that might contain dots or spaces
id: get_username
uses: mikefarah/[email protected]
with:
cmd: yq '.all.children.["${{ matrix.ip_address }}"].username' ops/inventories/production.yml
- name: Reuse a variable obtained in another step
run: echo ${{ steps.get_username.outputs.result }}
Thanks @MattiSG!
The default user in github action dockerfiles (at the time of writing) seems to be 1001. This is what the
yq
github action is configured to run with (see the docker file here)Last modified 9mo ago