@openactive/models-ts 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,50 +4,79 @@ on:
|
|
|
4
4
|
workflow_dispatch:
|
|
5
5
|
repository_dispatch:
|
|
6
6
|
types: [data-models-update]
|
|
7
|
+
# Lets other repositories (e.g. models-lib pull requests) test the TypeScript models generated
|
|
8
|
+
# from a specific models-lib or data-models ref. In that case no pull request is created.
|
|
9
|
+
workflow_call:
|
|
10
|
+
inputs:
|
|
11
|
+
models-lib_ref:
|
|
12
|
+
required: false
|
|
13
|
+
type: string
|
|
14
|
+
data-models_ref:
|
|
15
|
+
required: false
|
|
16
|
+
type: string
|
|
17
|
+
|
|
18
|
+
permissions:
|
|
19
|
+
contents: read
|
|
7
20
|
|
|
8
21
|
jobs:
|
|
9
22
|
generate:
|
|
10
23
|
runs-on: ubuntu-latest
|
|
11
24
|
|
|
12
25
|
steps:
|
|
26
|
+
# The repository is named explicitly, as this workflow can be called from another repository
|
|
13
27
|
- name: Checkout models-ts
|
|
14
|
-
uses: actions/checkout@
|
|
28
|
+
uses: actions/checkout@v4
|
|
15
29
|
with:
|
|
30
|
+
repository: openactive/models-ts
|
|
16
31
|
ref: main
|
|
17
32
|
path: models-ts
|
|
18
33
|
|
|
19
34
|
- name: Checkout models-lib
|
|
20
|
-
uses: actions/checkout@
|
|
35
|
+
uses: actions/checkout@v4
|
|
21
36
|
with:
|
|
22
37
|
repository: openactive/models-lib
|
|
38
|
+
ref: ${{ inputs.models-lib_ref }}
|
|
23
39
|
path: models-lib
|
|
24
40
|
|
|
25
|
-
- name: Setup Node.js
|
|
26
|
-
uses: actions/setup-node@
|
|
41
|
+
- name: Setup Node.js 18.17.1
|
|
42
|
+
uses: actions/setup-node@v4
|
|
27
43
|
with:
|
|
28
|
-
node-version:
|
|
29
|
-
|
|
44
|
+
node-version: 18.17.1
|
|
45
|
+
|
|
30
46
|
- name: Install models-lib
|
|
31
47
|
run: npm install
|
|
32
48
|
working-directory: ./models-lib/
|
|
33
|
-
|
|
49
|
+
|
|
34
50
|
- name: Update models-lib with latest data-models
|
|
51
|
+
if: ${{ !inputs.data-models_ref }}
|
|
35
52
|
run: npm update @openactive/data-models
|
|
36
53
|
working-directory: ./models-lib/
|
|
37
54
|
|
|
55
|
+
- name: Install data-models ${{ inputs.data-models_ref }}
|
|
56
|
+
if: ${{ inputs.data-models_ref }}
|
|
57
|
+
env:
|
|
58
|
+
DATA_MODELS_REF: ${{ inputs.data-models_ref }}
|
|
59
|
+
run: npm install "github:openactive/data-models#$DATA_MODELS_REF"
|
|
60
|
+
working-directory: ./models-lib/
|
|
61
|
+
|
|
38
62
|
- name: Run TypeScript models generator
|
|
39
63
|
run: npm start -- generate TypeScript --destination ../models-ts/src/
|
|
40
64
|
working-directory: ./models-lib/
|
|
41
|
-
|
|
65
|
+
|
|
42
66
|
- name: Install models-ts
|
|
43
67
|
run: npm install
|
|
44
68
|
working-directory: ./models-ts/
|
|
45
|
-
|
|
69
|
+
|
|
46
70
|
- name: Build models-ts types
|
|
47
71
|
run: npm run build
|
|
48
72
|
working-directory: ./models-ts/
|
|
49
73
|
|
|
74
|
+
- name: Test models-ts
|
|
75
|
+
run: npm test
|
|
76
|
+
working-directory: ./models-ts/
|
|
77
|
+
|
|
50
78
|
- name: Generate GitHub App Token
|
|
79
|
+
if: ${{ !inputs.models-lib_ref && !inputs.data-models_ref }}
|
|
51
80
|
uses: actions/create-github-app-token@v1
|
|
52
81
|
id: generate-token
|
|
53
82
|
with:
|
|
@@ -55,8 +84,9 @@ jobs:
|
|
|
55
84
|
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
|
|
56
85
|
|
|
57
86
|
- name: Create Pull Request
|
|
87
|
+
if: ${{ !inputs.models-lib_ref && !inputs.data-models_ref }}
|
|
58
88
|
id: cpr
|
|
59
|
-
uses: peter-evans/create-pull-request@
|
|
89
|
+
uses: peter-evans/create-pull-request@v7
|
|
60
90
|
with:
|
|
61
91
|
path: ./models-ts/
|
|
62
92
|
token: ${{ steps.generate-token.outputs.token }}
|
|
@@ -74,6 +104,10 @@ jobs:
|
|
|
74
104
|
draft: false
|
|
75
105
|
|
|
76
106
|
- name: Check outputs
|
|
107
|
+
if: ${{ !inputs.models-lib_ref && !inputs.data-models_ref }}
|
|
108
|
+
env:
|
|
109
|
+
PR_NUMBER: ${{ steps.cpr.outputs.pull-request-number }}
|
|
110
|
+
PR_URL: ${{ steps.cpr.outputs.pull-request-url }}
|
|
77
111
|
run: |
|
|
78
|
-
echo "Pull Request Number - $
|
|
79
|
-
echo "Pull Request URL - $
|
|
112
|
+
echo "Pull Request Number - $PR_NUMBER"
|
|
113
|
+
echo "Pull Request URL - $PR_URL"
|