sp-dev-fx-webparts/.github/workflows/merge-sample-json.yml

42 lines
1.1 KiB
YAML

name: Merge Sample JSON
on:
push:
branches:
# When someone push to `main` branch
- main
paths:
- 'samples/**/assets/sample.json'
jobs:
build:
name: 'Merge all sample.json files to samples.json'
runs-on: ubuntu-latest
steps:
- name: Join samples
uses: actions/checkout@v2
with:
path: './'
- run: |
jq -s '[.[][]]' samples/**/assets/sample.json > samples.json
- name: Validate JSON
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: /metadata-schema.json
INPUT_JSONS: /samples.json
- name: Commit updated file
uses: EndBug/add-and-commit@v6
with:
message: 'Updated samples.json'
add: 'samples.json --force'
cwd: './'
token: ${{ secrets.TOKEN }}
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Copy to the pages
uses: planetoftheweb/copy-to-branches@v1
env:
key: main
branches: gh-pages
files: samples.json