Skip to content

Update Types

Update Types #362

Workflow file for this run

name: Update Types
on:
schedule:
- cron: '45 5 * * SUN'
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
jobs:
update-types:
name: Update Types
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
submodules: recursive
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16.x
- name: Clone azure-rest-api-specs
uses: actions/checkout@v4
with:
repository: Azure/azure-rest-api-specs
path: workflow-temp/azure-rest-api-specs
ref: ${{ github.event.inputs.api_specs_ref || 'main' }}
- name: Build bicep-types dependency
run: |
npm ci
npm run build
working-directory: bicep-types/src/bicep-types
- name: Install autorest.bicep npm packages
run: npm ci
working-directory: src/autorest.bicep
- name: Build autorest.bicep
run: npm run build
working-directory: src/autorest.bicep
- name: Install generator npm packages
run: npm ci
working-directory: src/generator
- name: Run generator
run: |
if [ -z "${{ github.event.inputs.single_path }}" ]
then
npm run generate -- --specs-dir ../../workflow-temp/azure-rest-api-specs
else
npm run generate -- --specs-dir ../../workflow-temp/azure-rest-api-specs --single-path ${{ github.event.inputs.single_path }}
fi
working-directory: src/generator
- name: Write summary
if: ${{ always() }}
run: cat generated/summary.log >> $GITHUB_STEP_SUMMARY
- id: get_swagger_gh_uri
name: Get GitHub URI for azure-rest-api-specs
run: |
git_sha=`git rev-parse --short HEAD`
echo "gh_uri=https://github.com/Azure/azure-rest-api-specs/tree/$git_sha" >> $GITHUB_OUTPUT
working-directory: workflow-temp/azure-rest-api-specs
- name: Commit and push
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: |
Update types from ${{ steps.get_swagger_gh_uri.outputs.gh_uri }} ${{ github.event.inputs.single_path && format('(single path: {0})', github.event.inputs.single_path) || '' }}
branch: ${{ github.event.inputs.single_path && format('autogenerate-{0}', github.event.inputs.single_path) || 'autogenerate' }}
push_options: '--force'
create_branch: true