Skip to content

Merge pull request #3654 from hashicorp/data/regeneration-from-a59aa1… #1

Merge pull request #3654 from hashicorp/data/regeneration-from-a59aa1…

Merge pull request #3654 from hashicorp/data/regeneration-from-a59aa1… #1

name: Regenerate API Data with New Microsoft Graph Changes after PR Merge
on:
push:
branches:
- main
paths:
- '.github/workflows/**'
- 'config/microsoft-graph.hcl'
- 'submodules/msgraph-metadata'
- 'tools/importer-msgraph/**'
workflow_dispatch: # for manual invocations
concurrency:
group: 'regendataapi-msgraph-${{ github.head_ref }}'
cancel-in-progress: true
jobs:
regenerate-api-data:
runs-on: custom-linux-xl
permissions:
contents: write
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: '1.21.3'
- name: Setup .NET
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4.0.0
with:
dotnet-version: 7.0.x
- name: build and run importer-msgraph-metadata
id: import-data
run: |
cd ./tools/importer-msgraph-metadata
make tools
make build
make import-all-clean
env:
PANDORA_LOG: WARN
- name: then commit the diff
id: commit-imported-data
run: |
git checkout -b data/regeneration-from-${{ github.sha }}-msgraph
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 MSGraph Metadata"
- 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 }}-msgraph
- 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: Microsoft Graph - 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 }}-msgraph"
PR_TARGET: "main"
GITHUB_TOKEN: ${{ secrets.SERVICE_ACCOUNT_PANDORA_TOKEN }}