SDK Breaking Change Labels #566186
This file contains hidden or 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: SDK Breaking Change Labels | |
| on: | |
| check_run: | |
| types: [completed] | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| id-token: write | |
| jobs: | |
| sdk-breaking-change-labels: | |
| # Only run this job when the check run is 'SDK Validation *' | |
| if: | | |
| github.event.check_run.check_suite.app.name == 'Azure Pipelines' && | |
| contains(github.event.check_run.name, 'SDK Validation') | |
| name: SDK Breaking Change Labels | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: | | |
| .github | |
| # Only run the login and get token steps when the repository is azure-rest-api-specs-pr | |
| - if: github.event.repository.name == 'azure-rest-api-specs-pr' | |
| name: Azure Login with Workload Identity Federation | |
| uses: azure/login@v2 | |
| with: | |
| client-id: "936c56f0-298b-467f-b702-3ad5bf4b15c1" | |
| tenant-id: "72f988bf-86f1-41af-91ab-2d7cd011db47" | |
| allow-no-subscriptions: true | |
| - if: github.event.repository.name == 'azure-rest-api-specs-pr' | |
| name: Get ADO Token via Managed Identity | |
| run: | | |
| # Get token for Azure DevOps resource | |
| ADO_TOKEN=$(az account get-access-token --resource "499b84ac-1321-427f-aa17-267ca6975798" --query "accessToken" -o tsv) | |
| echo "ADO_TOKEN=$ADO_TOKEN" >> "$GITHUB_ENV" | |
| - name: Setup Node 20 and install deps | |
| uses: ./.github/actions/setup-node-install-deps | |
| with: | |
| # actions/github-script@v7 uses Node 20 | |
| node-version: 20.x | |
| # "--no-audit": improves performance | |
| # "--omit dev": not needed at runtime, improves performance | |
| install-command: "npm ci --no-audit --omit dev" | |
| working-directory: ./.github | |
| - name: Get label and action | |
| id: get-label-and-action | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { getLabelAndAction } = | |
| await import('${{ github.workspace }}/.github/workflows/src/sdk-breaking-change-labels.js'); | |
| return await getLabelAndAction({ github, context, core }); | |
| - if: | | |
| (fromJson(steps.get-label-and-action.outputs.result).labelAction == 'add' || | |
| fromJson(steps.get-label-and-action.outputs.result).labelAction == 'remove') | |
| name: Upload artifact with results | |
| uses: ./.github/actions/add-label-artifact | |
| with: | |
| name: "${{ fromJson(steps.get-label-and-action.outputs.result).labelName}}" | |
| # Convert "add/remove" to "true/false" | |
| value: "${{ fromJson(steps.get-label-and-action.outputs.result).labelAction == 'add' }}" | |
| - if: ${{ always() && fromJson(steps.get-label-and-action.outputs.result).headSha }} | |
| name: Upload artifact with head SHA | |
| uses: ./.github/actions/add-empty-artifact | |
| with: | |
| name: "head-sha" | |
| value: "${{ fromJson(steps.get-label-and-action.outputs.result).headSha }}" | |
| - if: ${{ always() && fromJson(steps.get-label-and-action.outputs.result).issueNumber > 0 }} | |
| name: Upload artifact with issue number | |
| uses: ./.github/actions/add-empty-artifact | |
| with: | |
| name: "issue-number" | |
| value: "${{ fromJson(steps.get-label-and-action.outputs.result).issueNumber }}" |