Converts data formats interchangeably. The following formats are supported: XML, YAML, JSON, PROPS.
Name | Required | Description | Possible values |
---|---|---|---|
input | Yes | Path to the file to be converted | <Path> |
from | Yes | Format of a data in input file |
json , xml , yaml , props |
to | Yes | Format of a data as a result | json , xml , yaml , props |
Name | Required | Description |
---|---|---|
output | Yes | Converted data is in a format defined in to argument |
docker-compose.yml
is a file to be converted into JSON
with the following
content:
version: '3.7'
services:
mongo:
image: mongo:4.2.3-bionic
networks:
- test-network
networks:
test-network:
name: test-network
driver: bridge
name: Convert
on: push
jobs:
converter:
name: Run converter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: fabasoad/data-format-converter-action@main
id: yaml2json
with:
input: 'docker-compose.yml'
from: 'yaml'
to: 'json'
- name: Print result
run: echo "${{ steps.yaml2json.outputs.output }}"
{
"version": 3.7,
"services": {
"mongo": {
"image": "mongo:4.2.3-bionic",
"networks": [
"test-network"
]
}
},
"networks": {
"test-network": {
"name": "test-network",
"driver": "bridge"
}
}
}
person.xml
is a file to be converted into YAML
with the following
content:
<person>
<name>John Doe</name>
<age>32</age>
<hobbies>Music</hobbies>
<hobbies>PC Games</hobbies>
</person>
name: Convert
on: push
jobs:
converter:
name: Run converter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: fabasoad/data-format-converter-action@main
id: xml2yaml
with:
input: 'person.xml'
from: 'xml'
to: 'yaml'
- name: Print result
run: echo "${{ steps.xml2yaml.outputs.output }}"
person:
name: John Doe
age: 32
hobbies:
- Music
- PC Games
What if
from
andto
are the same?
There will not be error or any exception in this case. Result will be read from
input
and returned as output
.
What OS are supported? I need to understand what type of runners I can use.
The following OS are supported: macOS ARM64
, macOS AMD64
, Windows x86
,
Windows AMD64
, Linux x86
, Linux ARM
, Linux ARM64
, Linux AMD64
.
If you find that some of these OS don't work please open an issue or PR with the fix. Thanks!