microsoft/typespec

Public

mirrored from https://github.com/microsoft/typespecAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
6357dc0d0e1fb00a591a2a8aaf243804d727e52b

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/consistency.yml

134lines · modecode

1name: Consistency
2
3# Controls when the workflow will run
4on:
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
13permissions:
14 contents: read
15
16# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17jobs:
18 check-changes:
19 name: Check Changes
20 runs-on: ubuntu-latest
21 if: |
22 github.event_name == 'pull_request' &&
23 !startsWith(github.head_ref, 'publish/') &&
24 !startsWith(github.head_ref, 'dependabot/') &&
25 !startsWith(github.head_ref, 'backmerge/') &&
26 !startsWith(github.head_ref, 'revert-')
27 steps:
28 - uses: actions/checkout@v6
29 with:
30 fetch-depth: 0 ## Needed for Changesets to find `main` branch
31
32 - uses: ./.github/actions/setup
33
34 - run: git fetch --force --no-tags origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }}
35 name: Get ${{ github.event.pull_request.base.ref }} ref for ${{ github.ref}}, evt ${{ github.event_name }}
36
37 - run: pnpm install
38 name: Install dependencies
39
40 - name: Create PR Comment
41 run: pnpm chronus-github get-pr-comment --out ./comment-out/comment.json
42 env:
43 GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
44
45 - uses: actions/upload-artifact@v7
46 with:
47 name: comment
48 path: comment-out/
49 retention-days: 1 # Only need for the next workflow so don't need to waste storageretention-days
50
51 - run: pnpm chronus verify --since ${{ github.event.pull_request.base.ref }}
52 name: Check changelog
53
54 # Validate spell check
55 spellcheck:
56 name: Spell check
57 runs-on: ubuntu-latest
58 steps:
59 - uses: actions/checkout@v6
60 with:
61 submodules: recursive
62 - uses: ./.github/actions/setup
63
64 - run: pnpm install
65 name: Install dependencies
66
67 - run: pnpm run cspell
68 name: Spell check
69
70 # Validate formatting
71 format:
72 name: Format
73 runs-on: ubuntu-latest
74 steps:
75 - uses: actions/checkout@v6
76 with:
77 submodules: recursive
78 - uses: ./.github/actions/setup
79
80 - run: pnpm install
81 name: Install dependencies
82
83 - run: pnpm --filter="@typespec/prettier-plugin-typespec..." run build
84 name: Build prettier plugin
85
86 - run: pnpm run format:check
87 name: Check formatting
88
89 # Lint
90 lint:
91 name: Lint
92 runs-on: ubuntu-latest
93 steps:
94 - uses: actions/checkout@v6
95 with:
96 submodules: recursive
97
98 - uses: ./.github/actions/setup
99
100 - run: pnpm install
101 name: Install dependencies
102
103 - run: pnpm --filter="@typespec/eslint-plugin..." run build
104 name: Build prettier plugin
105
106 - run: pnpm run lint
107 name: Lint
108
109 # cspell:ignore rhysd
110 # Content copied from https://raw.githubusercontent.com/rhysd/actionlint/2ab3a12c7848f6c15faca9a92612ef4261d0e370/.github/actionlint-matcher.json
111 - run: echo "::add-matcher::.github/matchers/actionlint.json"
112 name: Add actionlint problem matcher
113
114 - uses: docker://rhysd/actionlint:1.7.12
115 name: Lint workflows
116 with:
117 args: -color -verbose
118
119 # Check that all dependencies use the pnpm catalog
120 version-consistency:
121 name: Versions consistency
122 runs-on: ubuntu-latest
123 steps:
124 - uses: actions/checkout@v6
125 with:
126 submodules: recursive
127
128 - uses: ./.github/actions/setup
129
130 - run: pnpm install
131 name: Install dependencies
132
133 - run: pnpm run check-catalog
134 name: Check catalog usage
135