Update pnpm lock files #14120
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: Breaking Change Check | |
on: | |
# Postsubmit CI on main. | |
push: | |
branches: [main] | |
# Presubmit CI on PRs to all branches. | |
pull_request: | |
types: [labeled, unlabeled, opened, synchronize, reopened] | |
# Allows you to run this workflow manually from the Actions tab. | |
workflow_dispatch: | |
# cancel workflow when a newer version of the workflow is triggered on the same github ref | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# get matrix for ci-jobs | |
get_matrix: | |
name: Load CI Matrix Details | |
runs-on: ubuntu-latest | |
permissions: read-all | |
outputs: | |
matrix: ${{ steps.get-matrix.outputs.matrix }} | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE so job can access it | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Ensure node version is great enough | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
- id: get-matrix | |
run: echo "matrix=$(node ./common/scripts/workflow-read-matrix.mjs)" >> $GITHUB_OUTPUT | |
check_breaking_changes: | |
needs: get_matrix | |
name: 'Check Breaking Changes (${{ matrix.flavor }})' | |
runs-on: ubuntu-latest | |
permissions: read-all | |
strategy: | |
matrix: ${{ fromJSON(needs.get_matrix.outputs.matrix) }} | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE so job can access it | |
- uses: actions/checkout@v4 | |
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
with: | |
fetch-depth: 0 | |
# Ensure node version is great enough | |
- name: Use Node.js | |
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
# Try get node_modules from cache | |
- name: Restore node_modules from cache | |
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
uses: actions/cache@v4 | |
with: | |
path: common/temp/pnpm-store | |
key: ${{ runner.os }}-${{ hashFiles('common/config/rush/pnpm-lock.yaml') }} | |
# Install rush | |
- name: Install rush | |
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
run: npm install -g @microsoft/rush@$(jq -r '.rushVersion' "rush.json") | |
# Checkout the branch to be merged into in PR | |
- name: Checkout base branch | |
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
run: git checkout ${{ github.event.pull_request.base.sha }} | |
# Install dependencies for the base branch | |
- name: Install beta dependencies | |
if: ${{ matrix.flavor == 'beta' && github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
run: rush switch-flavor:beta | |
- name: Install beta-release dependencies | |
if: ${{ matrix.flavor == 'beta-release' && github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
run: rush switch-flavor:beta-release | |
- name: Install stable dependencies | |
if: ${{ matrix.flavor == 'stable' && github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
run: rush switch-flavor:stable | |
# Build base branch to generate base api file | |
- name: Build base api file | |
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
run: rush build -t @azure/communication-react | |
- name: Copy api file | |
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
working-directory: packages/communication-react/ | |
run: | | |
mkdir -p breaking-change-check/snapshots/ | |
cp dist/communication-react.d.ts breaking-change-check/snapshots/ | |
# Checkout branch to be merged in PR | |
- name: Checkout current branch | |
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
run: git checkout ${{ github.event.pull_request.head.ref }} | |
# Install dependencies for the current branch | |
- name: Install beta dependencies | |
if: ${{ matrix.flavor == 'beta' && github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
run: rush switch-flavor:beta | |
- name: Install stable dependencies | |
if: ${{ matrix.flavor == 'stable' && github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
run: rush switch-flavor:stable | |
# Build current branch to generate current api file | |
- name: Build current api file | |
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
run: rush build -t @azure/communication-react | |
# Compare api files and check for breaking changes | |
- name: Check breaking changes | |
if: ${{ github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'breaking-change') }} | |
working-directory: packages/communication-react/ | |
id: breaking-changes | |
run: rushx check-breaking-change | |
# Report result of breaking changes check | |
- name: Check result of breaking change check | |
if: ${{ always() && steps.breaking-changes.outcome == 'failure' }} | |
run: echo "Breaking changes detected, make sure if that is expected change, then add 'breaking-change' label to PR." && exit 1 |