-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into dependabot/npm_and_ya…
…rn/tools/vscode-json-languageservice-5.3.5
- Loading branch information
Showing
517 changed files
with
950,368 additions
and
24,691 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,109 @@ | ||
name: Generate Schemas | ||
|
||
on: | ||
schedule: | ||
- cron: '45 5 * * TUE,THU' | ||
workflow_dispatch: | ||
inputs: | ||
api_specs_ref: | ||
description: 'Git ref or full SHA for https://github.com/Azure/azure-rest-api-specs.' | ||
required: true | ||
default: 'main' | ||
single_path: | ||
description: 'The path to generate types for (e.g. "compute", or "keyvault"). Leave blank to generate all types.' | ||
required: false | ||
|
||
env: | ||
# This must be kept in sync with the arguments passed to the "batch" matrix | ||
BATCH_COUNT: 20 | ||
|
||
jobs: | ||
update-schemas: | ||
name: Update Schemas | ||
generate: | ||
name: Update Schemas Batch ${{ matrix.batch }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
batch: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] | ||
steps: | ||
- uses: actions/[email protected] | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Clone azure-rest-api-specs | ||
uses: actions/checkout@v2.3.5 | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: Azure/azure-rest-api-specs | ||
path: workflow-temp/azure-rest-api-specs | ||
ref: ${{ github.event.inputs.api_specs_ref }} | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Install generator npm packages | ||
run: npm ci | ||
working-directory: generator | ||
|
||
- id: generate | ||
name: Run generator | ||
|
||
- name: Run generator | ||
run: | | ||
if [ -z "${{ github.event.inputs.single_path }}" ] | ||
then | ||
npm run generate-all -- --local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" | ||
else | ||
npm run generate-single -- --base-path '${{ github.event.inputs.single_path }}/resource-manager' --local-path "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" | ||
fi | ||
rm -Rf "$GITHUB_WORKSPACE/schemas" | ||
rm -Rf "$GITHUB_WORKSPACE/summary.log" | ||
mkdir -p "$GITHUB_WORKSPACE/schemas" | ||
npm run generate-all -- \ | ||
--specs-dir "$GITHUB_WORKSPACE/workflow-temp/azure-rest-api-specs" \ | ||
--batch-count ${{ env.BATCH_COUNT }} \ | ||
--batch-index ${{ matrix.batch }} \ | ||
--summary-log-path "$GITHUB_WORKSPACE/summary.log" \ | ||
--combine-batch-mode true | ||
working-directory: generator | ||
|
||
- id: get_swagger_gh_uri | ||
name: Get GitHub URI for azure-rest-api-specs | ||
run: | | ||
git_sha=`git rev-parse HEAD` | ||
echo "::set-output name=gh_uri::https://github.com/Azure/azure-rest-api-specs/tree/$git_sha" | ||
working-directory: workflow-temp/azure-rest-api-specs | ||
- name: Upload Schemas | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: batch-${{ matrix.batch }}-schemas | ||
path: schemas | ||
if-no-files-found: error | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/[email protected] | ||
- name: Upload summary log | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
committer: GitHub <[email protected]> | ||
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | ||
signoff: false | ||
branch: autogenerate | ||
branch-suffix: short-commit-hash | ||
delete-branch: true | ||
title: | | ||
Update Generated Types ${{ github.event.inputs.single_path && format('(single path: {0})', github.event.inputs.single_path) || '' }} | ||
body: | | ||
Update Generated Types ${{ github.event.inputs.single_path && format('(single path: {0})', github.event.inputs.single_path) || '' }} | ||
name: batch-${{ matrix.batch }}-summary | ||
path: summary.log | ||
if-no-files-found: error | ||
|
||
Generate types for ${{ steps.get_swagger_gh_uri.outputs.gh_uri }} | ||
commit-message: | | ||
Update Generated Types ${{ github.event.inputs.single_path && format('(single path: {0})', github.event.inputs.single_path) || '' }} | ||
combine: | ||
needs: generate | ||
name: Combine Schema Batches | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
Generate types for ${{ steps.get_swagger_gh_uri.outputs.gh_uri }} | ||
labels: autogenerate | ||
draft: false | ||
- name: Download batch results | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: workflow-temp | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Install generator npm packages | ||
run: npm ci | ||
working-directory: generator | ||
|
||
- name: Combine batches | ||
run: | | ||
npm run combine-batches -- \ | ||
--input-path "$GITHUB_WORKSPACE/workflow-temp" \ | ||
--batch-count ${{ env.BATCH_COUNT }} | ||
working-directory: generator | ||
|
||
- name: Push to autogenerate-batch branch | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: Update Generated Schemas | ||
branch: autogenerate-batch | ||
push_options: '--force' | ||
create_branch: true |
Oops, something went wrong.