json2file 1.0.14

Generate file output from JSON
json2file-1.0.14 is not a library.
Visit the last successful build: json2file-1.7.8

Crates.io Codacy Badge CI Update release version. Public workflows that use this action.

Ubuntu Mac OS Windows

json2file

Generate file output from a JSON string.

Usage

...
    - name: Set output
      id: set-output
      run: |
        echo "color=green" >> $GITHUB_OUTPUT

    - name: Generate file output from json
      uses: tj-actions/json2file@v1
      with:
        directory: 'output'
        outputs:  ${{ toJSON(steps.set-output.outputs) }}
        keys: 'color'
        extension: 'txt'
...

The above example will create a file named color.txt in the output directory with the contents green.

$ cat ./output/color.txt
green

Inputs

INPUT TYPE REQUIRED DEFAULT DESCRIPTION
bin_path string false Path to the binary
directory string true ".github/outputs" Directory to write to
extension string false "txt" File extension to use
keys string true List of Keys to read from theoutputs JSON string
outputs string true JSON string
skip_missing_keys string false "false" Skip missing keys not found in theoutputs JSON string

CLI Reference

Run json2file --help for more information.

$ json2file --help
json2file
Generate files from a JSON output.

Usage:
        json2file --keys=[keys] --outputs=[output] --directory=[directory] --extension=[EXTENSION]

Options:

-h, --help              Show this help message and exit.
-v, --VERSION           Show the VERSION and exit.
-k, --keys              Space delimited list of keys to extract from the JSON output. (Required)
-o, --outputs           The JSON output to use. (Required)
-d, --directory         The directory to output the files to. (Required)
-e, --extension         The extension to use for the files. (Optional, defaults to txt)

Example:
        json2file --keys="foo bar" --outputs="{\"foo\": \"value1\", \"bar\": \"value2\"}" --directory=/tmp --extension=txt

If you feel generous and want to show some extra appreciation:

Buy me a coffee

Credits

This package was created with Cookiecutter using cookiecutter-action

Report Bugs

Report bugs at https://github.com/tj-actions/json2file/issues.

If you are reporting a bug, please include:

  • Your operating system name and VERSION.
  • Any details about your workflow that might be helpful in troubleshooting.
  • Detailed steps to reproduce the bug.