microsoft/typespec
Publicmirrored from https://github.com/microsoft/typespecAvailable
.github/workflows/consistency.yml
121lines · 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 | if: | |
| 19 | github.event_name == 'pull_request' && |
| 20 | !startsWith(github.head_ref, 'publish/') && |
| 21 | !startsWith(github.head_ref, 'dependabot/') && |
| 22 | !startsWith(github.head_ref, 'backmerge/') && |
| 23 | !startsWith(github.head_ref, 'revert-') |
| 24 | steps: |
| 25 | - uses: actions/checkout@v4 |
| 26 | with: |
| 27 | fetch-depth: 0 ## Needed for Changesets to find `main` branch |
| 28 | |
| 29 | - uses: ./.github/actions/setup |
| 30 | |
| 31 | - run: git fetch --force --no-tags origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }} |
| 32 | name: Get ${{ github.event.pull_request.base.ref }} ref for ${{ github.ref}}, evt ${{ github.event_name }} |
| 33 | |
| 34 | - run: pnpm install |
| 35 | name: Install dependencies |
| 36 | |
| 37 | - name: Create PR Comment |
| 38 | run: pnpm chronus-github get-pr-comment --out ./comment-out/comment.json |
| 39 | env: |
| 40 | GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 41 | |
| 42 | - uses: actions/upload-artifact@v4 |
| 43 | with: |
| 44 | name: comment |
| 45 | path: comment-out/ |
| 46 | retention-days: 1 # Only need for the next workflow so don't need to waste storageretention-days |
| 47 | |
| 48 | - run: pnpm chronus verify --since ${{ github.event.pull_request.base.ref }} |
| 49 | name: Check changelog |
| 50 | |
| 51 | # Validate spell check |
| 52 | spellcheck: |
| 53 | name: Spell check |
| 54 | runs-on: ubuntu-latest |
| 55 | steps: |
| 56 | - uses: actions/checkout@v4 |
| 57 | with: |
| 58 | submodules: recursive |
| 59 | - uses: ./.github/actions/setup |
| 60 | |
| 61 | - run: pnpm install |
| 62 | name: Install dependencies |
| 63 | |
| 64 | - run: pnpm run cspell |
| 65 | name: Spell check |
| 66 | |
| 67 | # Validate formatting |
| 68 | format: |
| 69 | name: Format |
| 70 | runs-on: ubuntu-latest |
| 71 | steps: |
| 72 | - uses: actions/checkout@v4 |
| 73 | with: |
| 74 | submodules: recursive |
| 75 | - uses: ./.github/actions/setup |
| 76 | |
| 77 | - run: pnpm install |
| 78 | name: Install dependencies |
| 79 | |
| 80 | - run: pnpm --filter="@typespec/prettier-plugin-typespec..." run build |
| 81 | name: Build prettier plugin |
| 82 | |
| 83 | - run: pnpm run format:check |
| 84 | name: Check formatting |
| 85 | |
| 86 | # Lint |
| 87 | lint: |
| 88 | name: Lint |
| 89 | runs-on: ubuntu-latest |
| 90 | steps: |
| 91 | - uses: actions/checkout@v4 |
| 92 | with: |
| 93 | submodules: recursive |
| 94 | |
| 95 | - uses: ./.github/actions/setup |
| 96 | |
| 97 | - run: pnpm install |
| 98 | name: Install dependencies |
| 99 | |
| 100 | - run: pnpm --filter="@typespec/eslint-plugin..." run build |
| 101 | name: Build prettier plugin |
| 102 | |
| 103 | - run: pnpm run lint |
| 104 | name: Lint |
| 105 | |
| 106 | # Check version mismatch |
| 107 | version-consistency: |
| 108 | name: Versions consistency |
| 109 | runs-on: ubuntu-latest |
| 110 | steps: |
| 111 | - uses: actions/checkout@v4 |
| 112 | with: |
| 113 | submodules: recursive |
| 114 | |
| 115 | - uses: ./.github/actions/setup |
| 116 | |
| 117 | - run: pnpm install |
| 118 | name: Install dependencies |
| 119 | |
| 120 | - run: pnpm run check-version-mismatch |
| 121 | name: Check version mismatch |
| 122 | |