Skip to content

Commit bc1dc54

Browse files
Merge pull request #1920 from Azure/ant/actions
Testing with GH action
2 parents f1abe54 + cf0505e commit bc1dc54

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Generate Types
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
api_specs_ref:
7+
description: 'Git ref or full SHA for https://github.com/Azure/azure-rest-api-specs.'
8+
required: true
9+
default: 'main'
10+
single_path:
11+
description: 'The path to generate types for (e.g. "compute", or "keyvault"). Leave blank to generate all types.'
12+
required: false
13+
14+
jobs:
15+
update-types:
16+
name: Update Types
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v2.3.4
21+
22+
- name: Clone azure-rest-api-specs
23+
uses: actions/checkout@v2.3.4
24+
with:
25+
repository: Azure/azure-rest-api-specs
26+
path: workflow-temp/azure-rest-api-specs
27+
ref: ${{ github.event.inputs.api_specs_ref }}
28+
29+
- name: Install generator npm packages
30+
run: npm ci
31+
working-directory: generator
32+
33+
- id: generate
34+
name: Run generator
35+
run: |
36+
if [ -z "${{ github.event.inputs.single_path }}" ]
37+
then
38+
npm run generate-all -- '{"localPath": "../workflow-temp/azure-rest-api-specs"}'
39+
else
40+
npm run generate-single -- '${{ github.event.inputs.single_path }}/resource-manager' '../workflow-temp/azure-rest-api-specs'
41+
fi
42+
working-directory: generator
43+
44+
- id: get_swagger_gh_uri
45+
name: Get GitHub URI for azure-rest-api-specs
46+
run: |
47+
git_sha=`git rev-parse HEAD`
48+
echo "::set-output name=gh_uri::https://github.com/Azure/azure-rest-api-specs/tree/$git_sha"
49+
working-directory: workflow-temp/azure-rest-api-specs
50+
51+
- name: Create Pull Request
52+
uses: peter-evans/create-pull-request@v3.10.1
53+
with:
54+
committer: GitHub <noreply@github.com>
55+
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
56+
signoff: false
57+
branch: autogenerate
58+
branch-suffix: short-commit-hash
59+
delete-branch: true
60+
title: |
61+
Update Generated Types ${{ github.event.inputs.single_path && format('(single path: {0})', github.event.inputs.single_path) || '' }}
62+
body: |
63+
Update Generated Types ${{ github.event.inputs.single_path && format('(single path: {0})', github.event.inputs.single_path) || '' }}
64+
65+
Generate types for ${{ steps.get_swagger_gh_uri.outputs.gh_uri }}
66+
commit-message: |
67+
Update Generated Types ${{ github.event.inputs.single_path && format('(single path: {0})', github.event.inputs.single_path) || '' }}
68+
69+
Generate types for ${{ steps.get_swagger_gh_uri.outputs.gh_uri }}
70+
labels: autogenerate
71+
draft: false

0 commit comments

Comments
 (0)