Skip to content

Commit 267b776

Browse files
committed
final update
1 parent cad53f2 commit 267b776

File tree

2 files changed

+51
-38
lines changed

2 files changed

+51
-38
lines changed

.github/workflows/generate-schemas-batch.yml

Lines changed: 50 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Generate Types
1+
name: Generate Schemas batch
22

33
on:
44
workflow_dispatch:
@@ -9,11 +9,14 @@ on:
99
default: 'main'
1010

1111
env:
12-
SUMMARY_LOG_PATH: tmp/summary/summary.log
12+
SUMMARY_LOG_DIR: /tmp/summary
13+
SUMMARY_LOG_PATH: /tmp/summary/summary.log
14+
SUMMARY_LOG_ARTIFACT_NAME: summary-log
1315
AUTOGENERATE_BRANCH_NAME: autogenerate
16+
MAIN_BRANCH_NAME: main
1417
jobs:
1518
batch-0:
16-
name: Update Types
19+
name: Update Schemas Batch 0
1720
runs-on: ubuntu-latest
1821
steps:
1922
- uses: actions/checkout@v2.3.5
@@ -28,25 +31,32 @@ jobs:
2831
- name: Install generator npm packages
2932
run: npm ci
3033
working-directory: generator
34+
35+
- name: Create initial log description
36+
run: mkdir -p /tmp/summary
3137

3238
- id: generate
3339
name: Run generator
3440
run: |
35-
npm run generate-all -- --local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" --summary-log-path $SUMMARY_LOG_PATH --batch-count 0
41+
npm run generate-all -- --local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" --summary-log-path $SUMMARY_LOG_PATH --batch-count 4 --batch-index 0
3642
working-directory: generator
37-
- name: Commit & push update
38-
run: |
39-
git add --all schemas
40-
git commit -m "Autogenerate schemas"
41-
git push origin $AUTOGENERATE_BRANCH_NAME
43+
44+
- name: Commit changes
45+
uses: EndBug/add-and-commit@v7
46+
with:
47+
author_name: github-actions
48+
author_email: github-actions@github.com
49+
message: 'Autogenerate schemas batch 0'
50+
add: '*.*'
51+
4252
- name: Upload summary log
4353
uses: actions/upload-artifact@v2
4454
with:
45-
name: summary-log
55+
name: ${{ env.SUMMARY_LOG_ARTIFACT_NAME }}
4656
path: ${{ env.SUMMARY_LOG_PATH }}
4757
batch-1:
4858
needs: batch-0
49-
name: Update Types
59+
name: Update Schemas Batch 1
5060
runs-on: ubuntu-latest
5161
steps:
5262
- uses: actions/checkout@v2.3.5
@@ -65,29 +75,31 @@ jobs:
6575
- name: Download summary log artifact
6676
uses: actions/download-artifact@v2
6777
with:
68-
name: summary-log
69-
path: ${{ env.SUMMARY_LOG_PATH }}
78+
name: ${{ env.SUMMARY_LOG_ARTIFACT_NAME }}
79+
path: ${{ env.SUMMARY_LOG_DIR }}
7080

7181
- id: generate
7282
name: Run generator
7383
run: |
74-
npm run generate-all -- --local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" --summary-log-path $SUMMARY_LOG_PATH --batch-count 1
84+
npm run generate-all -- --local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" --summary-log-path $SUMMARY_LOG_PATH --batch-count 4 --batch-index 1
7585
working-directory: generator
7686

77-
- name: Commit & push update
78-
run: |
79-
git add --all schemas
80-
git commit -m "Autogenerate schemas"
81-
git push origin $AUTOGENERATE_BRANCH_NAME
87+
- name: Commit changes
88+
uses: EndBug/add-and-commit@v7
89+
with:
90+
author_name: github-actions
91+
author_email: github-actions@github.com
92+
message: 'Autogenerate schemas batch 1'
93+
add: '*.*'
8294

8395
- name: Upload summary log
8496
uses: actions/upload-artifact@v2
8597
with:
86-
name: summary-log
98+
name: ${{ env.SUMMARY_LOG_ARTIFACT_NAME }}
8799
path: ${{ env.SUMMARY_LOG_PATH }}
88100
batch-2:
89101
needs: batch-1
90-
name: Update Types
102+
name: Update Schemas Batch 2
91103
runs-on: ubuntu-latest
92104
steps:
93105
- uses: actions/checkout@v2.3.5
@@ -106,29 +118,31 @@ jobs:
106118
- name: Download summary log artifact
107119
uses: actions/download-artifact@v2
108120
with:
109-
name: summary-log
110-
path: ${{ env.SUMMARY_LOG_PATH }}
121+
name: ${{ env.SUMMARY_LOG_ARTIFACT_NAME }}
122+
path: ${{ env.SUMMARY_LOG_DIR }}
111123

112124
- id: generate
113125
name: Run generator
114126
run: |
115-
npm run generate-all -- --local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" --summary-log-path $SUMMARY_LOG_PATH --batch-count 2
127+
npm run generate-all -- --local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" --summary-log-path $SUMMARY_LOG_PATH --batch-count 4 --batch-index 2
116128
working-directory: generator
117129

118-
- name: Commit & push update
119-
run: |
120-
git add --all schemas
121-
git commit -m "Autogenerate schemas"
122-
git push origin $AUTOGENERATE_BRANCH_NAME
130+
- name: Commit changes
131+
uses: EndBug/add-and-commit@v7
132+
with:
133+
author_name: github-actions
134+
author_email: github-actions@github.com
135+
message: 'Autogenerate schemas batch 2'
136+
add: '*.*'
123137

124138
- name: Upload summary log
125139
uses: actions/upload-artifact@v2
126140
with:
127-
name: summary-log
141+
name: ${{ env.SUMMARY_LOG_ARTIFACT_NAME }}
128142
path: ${{ env.SUMMARY_LOG_PATH }}
129143
batch-3:
130144
needs: batch-2
131-
name: Update Types
145+
name: Update Schemas Batch 3
132146
runs-on: ubuntu-latest
133147
steps:
134148
- uses: actions/checkout@v2.3.5
@@ -147,13 +161,13 @@ jobs:
147161
- name: Download summary log artifact
148162
uses: actions/download-artifact@v2
149163
with:
150-
name: summary-log
151-
path: ${{ env.SUMMARY_LOG_PATH }}
164+
name: ${{ env.SUMMARY_LOG_ARTIFACT_NAME }}
165+
path: ${{ env.SUMMARY_LOG_DIR }}
152166

153167
- id: generate
154168
name: Run generator
155169
run: |
156-
npm run generate-all -- --local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" --summary-log-path $SUMMARY_LOG_PATH --batch-count 3
170+
npm run generate-all -- --local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" --summary-log-path $SUMMARY_LOG_PATH --batch-count 4 --batch-index 3
157171
158172
summary="$(<$SUMMARY_LOG_PATH)"
159173
summary="${summary//'%'/'%25'}"
@@ -175,7 +189,7 @@ jobs:
175189
committer: GitHub <noreply@github.com>
176190
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
177191
signoff: false
178-
branch: autogenerate
192+
branch: ${{ env.MAIN_BRANCH_NAME }}
179193
branch-suffix: short-commit-hash
180194
delete-branch: true
181195
title: |
@@ -191,5 +205,5 @@ jobs:
191205
Update Generated Schemas ${{ github.event.inputs.single_path && format('(single path: {0})', github.event.inputs.single_path) || '' }}
192206
193207
Generate schemas for ${{ steps.get_swagger_gh_uri.outputs.gh_uri }}
194-
labels: autogenerate
208+
labels: ${{ env.AUTOGENERATE_BRANCH_NAME }}
195209
draft: false

generator/cmd/generateall.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { flatten, keys } from 'lodash';
99
import { executeSynchronous, chunker, writeJsonFile } from '../utils';
1010
import { Package } from '../models';
1111
import yargs from 'yargs';
12-
import path from 'path/posix';
12+
import path from 'path';
1313

1414
import { createWriteStream } from 'fs';
1515
import stripAnsi from 'strip-ansi';
@@ -55,7 +55,6 @@ executeSynchronous(async () => {
5555
}
5656

5757
const schemaConfigs: SchemaConfiguration[] = [];
58-
const errors = [];
5958
const packages: Package[] = [];
6059

6160
const summaryLogger = await getLogger(summaryPath);

0 commit comments

Comments
 (0)