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

42 lines
1.1 KiB
YAML
Raw Normal View History

2022-02-12 15:48:05 -05:00
name: Merge Sample JSON
on:
2022-02-12 22:05:46 -05:00
pull_request:
branches:
# When someone push to `main` branch
- main
paths:
- 'samples/**/assets/sample.json'
2022-02-12 15:48:05 -05:00
jobs:
2022-02-12 19:02:52 -05:00
build:
2022-02-12 19:42:39 -05:00
name: 'Merge all sample.json files to samples.json'
2022-02-12 19:02:52 -05:00
runs-on: ubuntu-latest
2022-02-12 15:48:05 -05:00
steps:
2022-02-12 19:42:39 -05:00
- name: Join samples
uses: actions/checkout@v2
2022-02-12 19:02:52 -05:00
with:
path: './'
- run: |
2022-02-12 19:11:58 -05:00
jq -s '[.[][]]' samples/**/assets/sample.json > samples.json
2022-02-12 20:34:18 -05:00
- name: Validate JSON
2022-02-12 20:33:06 -05:00
uses: docker://orrosenblatt/validate-json-action:latest
env:
INPUT_SCHEMA: /metadata-schema.json
INPUT_JSONS: /samples.json
2022-02-12 19:42:39 -05:00
- name: Commit updated file
uses: EndBug/add-and-commit@v6
2022-02-12 19:02:52 -05:00
with:
2022-02-12 19:11:58 -05:00
message: 'Updated samples.json'
add: 'samples.json --force'
2022-02-12 19:02:52 -05:00
cwd: './'
2022-02-12 19:42:39 -05:00
token: ${{ secrets.TOKEN }}
2022-02-12 20:15:57 -05:00
- uses: actions/checkout@v2
with:
fetch-depth: 0
2022-02-12 19:42:39 -05:00
- name: Copy to the pages
uses: planetoftheweb/copy-to-branches@v1
env:
2022-02-12 19:47:47 -05:00
key: main
2022-02-12 19:42:39 -05:00
branches: gh-pages
files: samples.json