forked from tombuildsstuff/kermit
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (64 loc) · 2.17 KB
/
regenerate-track1-sdk.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
name: Regenerate Track1 SDKs
on:
push:
branches:
- main
paths:
- '.github/**'
- 'config/**'
- 'swagger'
- 'tools/**'
jobs:
regenerate-track1-sdks:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-go@v2
with:
go-version: '1.18.5'
- uses: actions/setup-dotnet@v3
with:
# The Track1 AutoRest Generator requires .net core 2.x
dotnet-version: 2.2.x
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Generate Track1 SDKs
run: |
cd ./tools/autowrapper
make tools
make run
env:
NODE_OPTIONS: "--max-old-space-size=4096"
- name: Conditionally Commit the Generated Code
id: commit-generated-code
run: |
git checkout -b config/regeneration-from-${{ github.sha }}
git config user.name "GitHub Actions"
git config user.email '<>'
./scripts/conditionally-commit.sh "SDK: regenerating based on the latest Swagger"
- name: Format the Generated Code
id: fmt-generated-code
if: ${{ steps.commit-generated-code.outputs.has_changes_to_push == 'true' }}
run: |
cd ./tools/autowrapper
make tools
make fmt-generated
cd ../../
git config user.name "GitHub Actions"
git config user.email '<>'
./scripts/conditionally-commit.sh "SDK: formatting"
- name: Conditionally Send a Pull Request
id: push-and-open-pr
if: ${{ steps.commit-generated-code.outputs.has_changes_to_push == 'true' || steps.fmt-generated-code.outputs.has_changes_to_push == 'true' }}
run: |
git push origin config/regeneration-from-${{ github.sha }}
gh pr create --title "SDK: regenerating from ${{ github.sha }}" --body "Updating the Generated SDK based on the commit ${{ github.sha }}" -H "config/regeneration-from-${{ github.sha }}" -B main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}