-
Notifications
You must be signed in to change notification settings - Fork 28
99 lines (96 loc) · 3.81 KB
/
sync.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
88
89
90
91
92
93
94
95
96
97
98
99
name: Sync json schema
on:
schedule:
- cron: '00 00 * * *'
workflow_dispatch:
jobs:
sync-td:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Download schema
run: |
# Retrieve json schema from td repository
mkdir .temp && cd .temp
git init
git fetch https://github.com/w3c/wot-thing-description.git
git checkout FETCH_HEAD -- validation/td-json-schema-validation.json
- name: Look for changes
continue-on-error: true
run: |
git diff --no-index --quiet typescript/thing-description/schema/td-json-schema-validation.json .temp/validation/td-json-schema-validation.json
echo "::set-output name=changed::$?"
id: diff
- name: Sync file
if: ${{ ! steps.diff.outputs.changed }}
run: mv .temp/validation/td-json-schema-validation.json typescript/thing-description/schema/td-json-schema-validation.json && rm -rf .temp
- name: Generate types
if: ${{ ! steps.diff.outputs.changed }}
run: |
cd typescript
npm install
npm run build --workspace=thing-description
- name: Push changes
if: ${{ ! steps.diff.outputs.changed }}
uses: EndBug/add-and-commit@v7
with:
# focus only on the schema and the generated file just to be sure
add: '["typescript/thing-description/schema","typescript/thing-description/thing-description.d.ts"]'
author_name: action_sync
message: 'chore(typescript): sync thing description json schema from wot-thing-description.git'
pull: '--rebase --autostash'
- uses: JasonEtco/create-an-issue@v2
if: ${{ ! steps.diff.outputs.changed }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_NAME: thing-description
with:
filename: .github/publish-ts-issue.md
sync-tm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Download schema
run: |
# Retrieve json schema from td repository
mkdir .temp && cd .temp
git init
git fetch https://github.com/w3c/wot-thing-description.git
git checkout FETCH_HEAD -- validation/tm-json-schema-validation.json
- name: Look for changes
continue-on-error: true
run: |
git diff --no-index --quiet typescript/thing-model/schema/tm-json-schema-validation.json .temp/validation/tm-json-schema-validation.json
echo "::set-output name=changed::$?"
id: diff
- name: Sync file
if: ${{ ! steps.diff.outputs.changed }}
run: mv .temp/validation/tm-json-schema-validation.json typescript/thing-model/schema/tm-json-schema-validation.json && rm -rf .temp
- name: Generate types
if: ${{ ! steps.diff.outputs.changed }}
run: |
cd typescript
npm install
npm run build --workspace=thing-model
- name: Push changes
if: ${{ ! steps.diff.outputs.changed }}
uses: EndBug/add-and-commit@v7
with:
# focus only on the schema and the generated file just to be sure
add: '["typescript/thing-model/schema","typescript/thing-model/thing-model.d.ts"]'
author_name: action_sync
message: 'chore(typescript): sync thing model json schema from wot-thing-description.git'
pull: '--rebase --autostash'
- uses: JasonEtco/create-an-issue@v2
if: ${{ ! steps.diff.outputs.changed }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACKAGE_NAME: thing-model
with:
filename: .github/publish-ts-issue.md