https://github.com/benlei/yaml2outputs
This action will read in a YAML body / file and set them as outputs
https://github.com/benlei/yaml2outputs
github-actions workflows yaml
Last synced: about 1 month ago
JSON representation
This action will read in a YAML body / file and set them as outputs
- Host: GitHub
- URL: https://github.com/benlei/yaml2outputs
- Owner: benlei
- License: mit
- Created: 2024-09-22T19:18:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-05-18T03:34:40.000Z (about 1 month ago)
- Last Synced: 2026-05-18T05:40:03.989Z (about 1 month ago)
- Topics: github-actions, workflows, yaml
- Language: TypeScript
- Homepage:
- Size: 755 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# benlei/yaml2outputs

[](https://github.com/benlei/yaml2outputs/actions/workflows/check-dist.yml)
[](https://github.com/benlei/yaml2outputs/actions/workflows/codeql-analysis.yml)
[](./badges/coverage.svg)
Reads in a `yaml` input (or `file` input) and tries to output its values in dot
notation. Note that if the YAML/file is a primitive/missing/has errors, nothing
will be output.
For example given the YAML:
```yaml
foo:
bar:
- 1
- 2
- 3
hello:
world: abc
example.com/foobar: bye
'yes': true
'no': false
```
Should output the following:
- `steps.my-id.outputs['foo.bar[0]'] = '1'`
- `steps.my-id.outputs['foo.bar[1]'] = '2'`
- `steps.my-id.outputs['foo.bar[2]'] = '3'`
- `steps.my-id.outputs['hello.world'] = 'abc'`
- `steps.my-id.outputs['hello["example.com/foobar"]'] = 'bye'`
- `steps.my-id.outputs['hello.yes'] = 'true'`
- `steps.my-id.outputs['hello.no'] = 'false'`
## Inputs
| Input Name | Required | Default | Description |
| ---------- | -------- | ------- | ---------------------------------------------------------------- |
| `yaml` | no | `''` | The YAML body (string) to parse |
| `file` | no | `''` | The YAML file to parse. Ignored if `yaml` has a non-empty value. |
## Outputs
Varies depending on inputs.
## Example
### Passing in a raw YAML body
```yaml
- name: Test
id: yaml
uses: benlei/yaml2outputs@v1
with:
yaml: |
foo:
bar:
- 1
- 2
- 3
hello:
world: abc
example.com/foobar: bye
'yes': true
'no': false
- name: Output value:
run: |
echo ${{ steps.yaml.outputs['hello["example.com/foobar"]'] }}
```
### Passing in a YAML file
```yaml
- name: Test
id: yaml
uses: benlei/yaml2outputs@v1
with:
file: ./some.yaml
- name: Output value:
run: |
echo ${{ steps.yaml.outputs['hello["example.com/foobar"]'] }}
```