Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.
/ get-json-paths-action Public archive

A GitHub Action to access deep values of JSON strings

License

Notifications You must be signed in to change notification settings

gr2m/get-json-paths-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

💁‍♂️ This action is now obsolete

Use the built-in fromJSON(value) function instead

Get JSON paths action

A GitHub Action to access deep values of JSON strings

Build Status Greenkeeper

Usage

Minimal example

Name: Minimal example
on: [push]

jobs:
  minimal_example:
    runs-on: ubuntu-latest
    steps:
      - id: action_with_json_output
        run: 'echo ::set-output name=data::{ "foo": { "bar":"baz" } }'
      - id: data
        uses: gr2m/get-json-paths-action@v1.x
        with:
          json: ${{ steps.action_with_json_output.outputs.data }}
          bar: "foo.bar"
      - run: "echo bar is ${{ steps.data.outputs.bar }}"

Example with octokit/request-action

Name: Request example
on:
  push:
    branches:
      - master

jobs:
  request_example:
    runs-on: ubuntu-latest
    steps:
      - id: request
        uses: octokit/request-action@v2.x
        with:
          route: GET /repos/:owner/:repo/releases/latest
          owner: gr2m
          repo: get-json-paths-action
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      - id: result
        uses: gr2m/get-json-paths-action@v1.x
        with:
          json: ${{ steps.request.outputs.data }}
          name: "name"
          tag_name: "tag_name"
          created_by: "author.login"
      - run: "echo latest release: ${{ steps.result.outputs.name }} (${{ steps.result.outputs.tag_name }}) by ${{ ${{ steps.result.outputs.login }}"

Debugging

To see additional debug logs, create a secret with the name: ACTIONS_STEP_DEBUG and value true.

How it works

get-json-paths-action is using lodash.get to access deep properties at the provided path. json is the only required input. All other inputs are turned into equally named outputs with the value at the given paths.

License

MIT

About

A GitHub Action to access deep values of JSON strings

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published