generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1c00396
commit 59cdcc3
Showing
1 changed file
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}" | ||
``` |