-
Notifications
You must be signed in to change notification settings - Fork 50
69 lines (59 loc) · 2.31 KB
/
automation-rest-api-specs-importer.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
name: Regenerate API Data with New Changes after PR Merge
on:
push:
branches:
- main
paths:
- '.github/workflows/**'
- 'config/**'
- 'swagger'
- 'tools/importer-rest-api-specs/**'
concurrency:
group: 'regendataapi-${{ github.head_ref }}'
cancel-in-progress: true
jobs:
regenerate-api-data:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
submodules: recursive
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: '1.20.5'
- name: Setup .NET
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
with:
dotnet-version: 7.0.x
- name: build and run importer-rest-api-specs
id: import-data
run: |
cd ./tools/importer-rest-api-specs
make tools
make build
make import
- name: then commit the diff
id: commit-imported-data
run: |
git checkout -b data/regeneration-from-${{ github.sha }}
git config user.name "hc-github-team-tf-azure"
git config user.email "<>"
./scripts/conditionally-commit-codegen-changes.sh "data: regenerating based on the latest Swagger"
- name: then conditionally push the branch
id: push-branch
if: ${{ steps.commit-versions-config.outputs.has_changes_to_push == 'true' || steps.commit-imported-data.outputs.has_changes_to_push == 'true' }}
run: |
git push origin data/regeneration-from-${{ github.sha }}
- name: then conditionally open a pull request
id: open-pr
if: ${{ steps.commit-versions-config.outputs.has_changes_to_push == 'true' || steps.commit-imported-data.outputs.has_changes_to_push == 'true' }}
run: |
gh pr create --title "$PR_TITLE" --body "$PR_BODY" -H "$PR_SOURCE" -B "$PR_TARGET"
env:
PR_TITLE: "Data: regenerating based on ${{ github.sha }}"
PR_BODY: "This PR is automatically generated based on the commit ${{ github.sha }}"
PR_SOURCE: "data/regeneration-from-${{ github.sha }}"
PR_TARGET: "main"
GITHUB_TOKEN: ${{ secrets.SERVICE_ACCOUNT_PANDORA_TOKEN }}