yq yaml parser
ActionsTags
(2)This action reads values from a YAML file setting as action outputs.
Here's an example of how to use this action in a workflow file:
name: Example Workflow
on:
workflow_dispatch:
inputs:
yaml-file-path:
description: 'Path to the yaml file to parser'
required: true
type: string
yaml-filtering-keys:
description: 'Read using specific filter'
required: false
type: string
yaml-renaming-outputs:
description: 'Used to rename the default output name'
required: false
type: string
jobs:
yq-yaml-parser:
name: Yq yaml parser
runs-on: ubuntu-latest
steps:
- name: Yaml to outputs
id: yaml-to-outputs
uses: actions-betaon/[email protected]
with:
file-path: '${{ inputs.yaml-file-path }}'
filtering-keys: '${{ inputs.yaml-filtering-keys }}'
renaming-outputs: '${{ inputs.yaml-renaming-outputs }}'
Input | Description | Required |
---|---|---|
file-path |
Path to the YAML file to parse as output | true |
filtering-keys |
The YAML key names filter to apply | false |
renaming-outputs |
The YAML rename "keyname=output" output list | false |
sample:
key-1: value 1
key-2: |
value 2 with
2 lines
key-3:
- nested value 1
- nested value 2
sample_key-1=value 1
sample_key-2<<EOF
value 2 with
2 lines
EOF
sample_key-3_0=nested value 1
sample_key-3_1=nested value 2
The input filtering-keys can be used to filter the outputs using four methods:
- Filter by keys
- Exclude by keys
- Filter by regular expression
- Exclude by regular expression
This method filter outputs using the exact match by key name.
To filter, simply apply the keys names to be filtered.
filtering-keys: |
my-key_custom
my-key_specific
This method exlude outputs using the exact match by key name.
To apply the exlude filter, you must add the symbol "!" before the keys names.
filtering-keys: |
!my-key_custom
!my-key_specific
This method filter outputs using a regular expression pattern.
To filter using regular expression, you must add the symbol "+" before the regular expression pattern.
filtering-keys: |
+.*custom.*
+.*specific.*
This method exclude outputs using a regular expression pattern.
To apply the exlude regular expression, you must add the symbol "-" before the regular expression pattern.
filtering-keys: |
-.*custom.*
-.*specific.*
This action uses alpine linux base image. The regular expression pattern is applied internally using busybox grep.
Due this, some complex regular expression patterns may not work properly.
yq yaml parser is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.