microsoft/typespec
Publicmirrored from https://github.com/microsoft/typespecAvailable
.github/workflows/consistency.yml
89lines · modecode
| 1 | name: Consistency |
| 2 | |
| 3 | # Controls when the workflow will run |
| 4 | on: |
| 5 | # Triggers the workflow on push or pull request events but only for the "main" branch |
| 6 | push: |
| 7 | branches: ["main"] |
| 8 | pull_request: |
| 9 | branches: ["main"] |
| 10 | merge_group: |
| 11 | workflow_dispatch: {} |
| 12 | |
| 13 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 14 | jobs: |
| 15 | check-changes: |
| 16 | name: Check Changes |
| 17 | runs-on: ubuntu-latest |
| 18 | steps: |
| 19 | - uses: actions/checkout@v4 |
| 20 | with: |
| 21 | fetch-depth: 0 ## Needed for Changesets to find `main` branch |
| 22 | submodules: recursive |
| 23 | |
| 24 | - uses: ./.github/actions/setup |
| 25 | |
| 26 | - run: git pull --force --no-tags origin main:main |
| 27 | name: Get main ref |
| 28 | |
| 29 | - run: pnpm install |
| 30 | name: Install dependencies |
| 31 | |
| 32 | - run: npx chronus verify |
| 33 | name: Check changelog |
| 34 | if: ${{ !startsWith(github.head_ref, 'publish/') && !startsWith(github.head_ref, 'dependabot/') && !startsWith(github.head_ref, 'backmerge/') }} |
| 35 | |
| 36 | # Validate spell check |
| 37 | spellcheck: |
| 38 | name: Spell check |
| 39 | runs-on: ubuntu-latest |
| 40 | steps: |
| 41 | - uses: actions/checkout@v4 |
| 42 | with: |
| 43 | submodules: recursive |
| 44 | - uses: ./.github/actions/setup |
| 45 | |
| 46 | - run: pnpm install |
| 47 | name: Install dependencies |
| 48 | |
| 49 | - run: pnpm run cspell |
| 50 | name: Spell check |
| 51 | |
| 52 | # Validate formatting |
| 53 | format: |
| 54 | name: Format |
| 55 | runs-on: ubuntu-latest |
| 56 | steps: |
| 57 | - uses: actions/checkout@v4 |
| 58 | with: |
| 59 | submodules: recursive |
| 60 | - uses: ./.github/actions/setup |
| 61 | |
| 62 | - run: pnpm install |
| 63 | name: Install dependencies |
| 64 | |
| 65 | - run: pnpm --filter="@typespec/prettier-plugin-typespec..." run build |
| 66 | name: Build prettier plugin |
| 67 | |
| 68 | - run: pnpm run format:check |
| 69 | name: Check formatting |
| 70 | |
| 71 | # Lint |
| 72 | lint: |
| 73 | name: Lint |
| 74 | runs-on: ubuntu-latest |
| 75 | steps: |
| 76 | - uses: actions/checkout@v4 |
| 77 | with: |
| 78 | submodules: recursive |
| 79 | |
| 80 | - uses: ./.github/actions/setup |
| 81 | |
| 82 | - run: pnpm install |
| 83 | name: Install dependencies |
| 84 | |
| 85 | - run: pnpm --filter="@typespec/eslint-plugin..." run build |
| 86 | name: Build prettier plugin |
| 87 | |
| 88 | - run: pnpm run lint |
| 89 | name: Lint |
| 90 | |