Merge pull request #4415 from Chambras/add_appplatform_2024-05-01-pre… #1448
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
name: Regenerate API Data with New Resource Manager Changes after PR Merge | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'config/resource-manager.hcl' | |
- 'config/resources/**' | |
- 'submodules/rest-api-specs' | |
- 'tools/importer-rest-api-specs/**' | |
workflow_dispatch: # for manual invocations | |
concurrency: | |
group: 'regendataapi-resourcemanager-${{ github.head_ref }}' | |
cancel-in-progress: true | |
jobs: | |
regenerate-api-data: | |
runs-on: custom-linux-xl | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
submodules: recursive | |
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | |
with: | |
go-version-file: ./.go-version | |
- 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 }}-rest-api-specs | |
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 }}-rest-api-specs | |
- 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: Rest Api Specs - 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 }}-rest-api-specs" | |
PR_TARGET: "main" | |
GITHUB_TOKEN: ${{ secrets.SERVICE_ACCOUNT_PANDORA_TOKEN }} |