-
Notifications
You must be signed in to change notification settings - Fork 166
87 lines (85 loc) · 3.23 KB
/
merge-sample-json.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Merge sample metadata
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
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: Checkout main branch
uses: actions/checkout@v3
with:
ref: main
path: main
- name: Checkout gh-pages branch
uses: actions/checkout@v3
with:
ref: gh-pages
path: gh-pages
- name: Checkout Docs branch
uses: actions/checkout@v3
with:
ref: Docs
path: Docs
- name: Download Power Apps samples
run: |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3.raw" \
-o ./main/.metadata/powerapps-samples.json \
https://raw.githubusercontent.com/pnp/powerapps-samples/main/.metadata/samples.json
- name: Download Power Automate samples
run: |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3.raw" \
-o ./main/.metadata/powerautomate-samples.json \
https://raw.githubusercontent.com/pnp/powerautomate-samples/main/.metadata/samples.json
- name: Download Power Fx samples
run: |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3.raw" \
-o ./main/.metadata/powerfx-samples.json \
https://raw.githubusercontent.com/pnp/powerfx-samples/main/.metadata/samples.json
- name: Download Power Virtual Agents samples
run: |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3.raw" \
-o ./main/.metadata/powerva-samples.json \
https://raw.githubusercontent.com/pnp/powerva-samples/main/.metadata/samples.json
- name: Join samples
run: |
jq -s '[.[][]]' ./main/samples/**/assets/sample.json ./main/.metadata/powerapps-samples.json ./main/.metadata/powerautomate-samples.json ./main/.metadata/powerfx-samples.json ./main/.metadata/powerva-samples.json> ./Docs/docs/samples.json
- name: Validate JSON
uses: docker://orrosenblatt/validate-json-action:latest
continue-on-error: true
env:
INPUT_SCHEMA: ./main/templates/metadata-schema.json
INPUT_JSONS: ./Docs/docs/samples.json
- name: copy file to gh-pages
uses: canastro/copy-file-action@master
with:
source: "./Docs/docs/samples.json"
target: "./gh-pages/samples.json"
- name: Commit samples.json to gh-pages
uses: EndBug/add-and-commit@v9
with:
cwd: ./gh-pages
branch: gh-pages
add: 'samples.json --force'
push: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Commit samples.json to Docs
uses: EndBug/add-and-commit@v9
with:
cwd: ./Docs
branch: Docs
add: 'docs/samples.json --force'
push: true
token: ${{ secrets.GITHUB_TOKEN }}