Merge pull request #183 from anoopt/main #80
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
name: Merge sample metadata | |
on: | |
push: | |
branches: | |
# When someone push to `main` branch | |
- main | |
paths: | |
- 'samples/**/assets/sample.json' | |
- 'scenarios/**/assets/sample.json' | |
workflow_dispatch: | |
jobs: | |
build: | |
name: 'Merge all sample.json files to samples.json' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
path: main | |
- name: Checkout gh-pages branch | |
uses: actions/checkout@v2 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Join samples | |
run: | | |
jq -s '[.[][]]' ./main/samples/**/assets/sample.json ./main/scenarios/**/assets/sample.json > ./gh-pages/samples.json | |
- name: Validate JSON | |
uses: docker://orrosenblatt/validate-json-action:latest | |
env: | |
INPUT_SCHEMA: ./main/templates/metadata-schema.json | |
INPUT_JSONS: ./gh-pages/samples.json | |
- name: Commit samples.json to gh-pages | |
uses: EndBug/add-and-commit@v6 | |
with: | |
cwd: ./gh-pages | |
branch: gh-pages | |
add: 'samples.json --force' | |
push: true | |
token: ${{ secrets.GITHUB_TOKEN }} |