Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 1.54 KB

README.md

File metadata and controls

55 lines (37 loc) · 1.54 KB

Build

Description

Reads a package.json file and returns the contents as environment variables. Naming convention depends on the file name. For example, if the file is named package.json, the environment variables will be prefixed with PACKAGE_. If the file is named testing.json, the environment variables will be prefixed with TESTING_.

Example Usage

- name: Package.json info
  uses: rexdefuror/[email protected]

- run: echo "name - ${{ env.PACKAGE_NAME }}"
- run: echo "version - ${{ env.PACKAGE_VERSION }}"
- run: echo "description - ${{ env.PACKAGE_DESCRIPTION }}"

Example with custom file name

- name: Package.json info
  uses: rexdefuror/[email protected]
  with:
    file: testing.json

- run: echo "name - ${{ env.TESTING_NAME }}"
- run: echo "version - ${{ env.TESTING_VERSION }}"
- run: echo "description - ${{ env.TESTING_DESCRIPTION }}"

Example with custom path

- name: Package.json info
  uses: rexdefuror/[email protected]
  with:
    file: testing.json
    path: ./src

- run: echo "name - ${{ env.TESTING_NAME }}"
- run: echo "version - ${{ env.TESTING_VERSION }}"
- run: echo "description - ${{ env.TESTING_DESCRIPTION }}"

Inputs

file

Optional The name of the file to read. Default "package.json".

path

Optional The path to the file. Default "./".