diff --git a/.github/workflows/consistency.yml b/.github/workflows/consistency.yml new file mode 100644 index 00000000000..93eff63678a --- /dev/null +++ b/.github/workflows/consistency.yml @@ -0,0 +1,44 @@ +name: Consistency + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the "main" branch + push: + branches: ["main"] + pull_request: + branches: ["main"] + merge_group: + workflow_dispatch: {} + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + check-changes: + name: Check Changes + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 ## Needed for Changesets to find `main` branch + submodules: recursive + + - name: Install pnpm + uses: pnpm/action-setup@v2 + + - run: git pull --force --no-tags origin main:main + name: Get main ref + + - run: pnpm install + name: Install dependencies + + - run: pnpm change verify + name: Check changelog + if: ${{ !startsWith(github.head_ref, 'publish/') && !startsWith(github.head_ref, 'dependabot/') && !startsWith(github.head_ref, 'backmerge/') }} + + - run: pnpm check-version-mismatch + name: Check version mismatch + + - run: pnpm lint + name: Lint project + + - run: pnpm check-format + name: Check formatting diff --git a/.github/workflows/prepare-auto-release-branch.yml b/.github/workflows/prepare-auto-release-branch.yml index 541f17c7b15..8cba349335a 100644 --- a/.github/workflows/prepare-auto-release-branch.yml +++ b/.github/workflows/prepare-auto-release-branch.yml @@ -9,7 +9,6 @@ on: concurrency: ${{ github.workflow }}-${{ github.ref }} permissions: - pull-requests: write contents: write jobs: @@ -34,4 +33,4 @@ jobs: - name: Create release branch run: node ./eng/publish.mjs env: - GITHUB_TOKEN: ${{secrets.CUSTOM_GITHUB_TOKEN}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/eng/pipelines/ci-template.yml b/eng/pipelines/ci-template.yml index ce609e390f1..77216c0fd5f 100644 --- a/eng/pipelines/ci-template.yml +++ b/eng/pipelines/ci-template.yml @@ -55,6 +55,12 @@ steps: workingDirectory: $(Build.SourcesDirectory)/autorest.python/ condition: and(succeeded(), eq(${{ parameters.updateToLatestTypespec }}, false)) + - script: pnpm change verify + displayName: Check changelog + workingDirectory: $(Build.SourcesDirectory)/autorest.python/ + condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/publish/')), not(startsWith(variables['Build.SourceBranch'], 'refs/heads/dependabot/'))) + continueOnError: true + - script: pnpm list displayName: Pnpm list workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/typespec-python @@ -63,18 +69,6 @@ steps: displayName: Build project workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - - script: pnpm check-version-mismatch - displayName: Check version mismatch - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - - - script: pnpm lint - displayName: Lint project - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - - - script: pnpm check-format - displayName: Check formatting - workingDirectory: $(Build.SourcesDirectory)/autorest.python/ - - script: pip install -r dev_requirements.txt displayName: Pip install dev requirements workingDirectory: $(Build.SourcesDirectory)/autorest.python/packages/${{parameters.folderName}} diff --git a/package.json b/package.json index 025b70a072b..3de735aeed1 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "workspaces": [ "packages/*" ], + "packageManager": "pnpm@8.13.1", "scripts": { "preinstall": "npx only-allow pnpm", "watch": "tsc --build ./tsconfig.ws.json --watch",