Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
chdanielmueller committed Jun 13, 2023
1 parent 1c00396 commit 59cdcc3
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,53 @@
![Build Status](https://github.com/Surnet/get-json-matrix/actions/workflows/test.yml/badge.svg)](https://github.com/Surnet/get-json-matrix)
[![Build Status](https://github.com/Surnet/get-json-matrix/actions/workflows/test.yml/badge.svg)](https://github.com/Surnet/get-json-matrix)

# Surnet/get-json-matrix

This action gets a GitHub Action Matrix from a JSON.

## Inputs

### `filepath`

The path to the JSON file (defaults to: ./matrix.json)

## Example usage

This runs for the file ./matrix.json in our repository and outputs the

```yaml
name: Run for every X in JSON

on:
push:

jobs:
get-matrix:
name: Get Matrix from JSON
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get Matrix
id: matrix
uses: Surnet/get-json-matrix@v1
with:
filepath: ./matrix.json

run-for-everything:
name: Run for each Key Value combination in the JSON
needs: get-matrix
permissions: {}
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.get-matrix.outputs.matrix) }}
steps:
- name: Echo matrix
run: |
echo "${{ matrix.key }}"
echo "${{ matrix.value }}"
```

0 comments on commit 59cdcc3

Please sign in to comment.