Repository navigation
ci: update the GitHub Actions to their current majors #4
Workflow file for this run
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| # Only one run per branch/PR; a new push cancels the previous run. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| permissions: | |
| contents: read | |
| jobs: | |
| commit-messages: | |
| name: Commit messages | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Check out the full history | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| # Pinned to the version that generated pnpm-lock.yaml; `allowBuilds` | |
| # in pnpm-workspace.yaml is a pnpm 10+ feature. | |
| version: 12.21.0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: 22.x | |
| cache: pnpm | |
| - name: Install the dependencies | |
| run: pnpm install --frozen-lockfile | |
| # The range is the commits the event actually introduced: the PR's | |
| # base..head, or everything a push added. Merge commits are ignored | |
| # through config-conventional's default ignores. | |
| - name: Lint the commit messages | |
| env: | |
| EVENT_NAME: ${{ github.event_name }} | |
| PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| PUSH_BEFORE_SHA: ${{ github.event.before }} | |
| PUSH_HEAD_SHA: ${{ github.sha }} | |
| run: | | |
| set -euo pipefail | |
| if [ "$EVENT_NAME" = "pull_request" ]; then | |
| from="$PR_BASE_SHA" | |
| to="$PR_HEAD_SHA" | |
| elif [ -n "${PUSH_BEFORE_SHA:-}" ] \ | |
| && [ "$PUSH_BEFORE_SHA" != "0000000000000000000000000000000000000000" ] \ | |
| && git cat-file -e "${PUSH_BEFORE_SHA}^{commit}" 2>/dev/null; then | |
| from="$PUSH_BEFORE_SHA" | |
| to="$PUSH_HEAD_SHA" | |
| else | |
| # No usable base revision - the first push of a branch. `--to` | |
| # without `--from` lints every commit reachable from that revision. | |
| echo "No usable base revision; linting the whole history." | |
| pnpm exec commitlint --to "$PUSH_HEAD_SHA" --verbose | |
| exit 0 | |
| fi | |
| echo "Linting the commit range $from..$to" | |
| pnpm exec commitlint --from "$from" --to "$to" --verbose | |
| # A squash merge turns the pull request title into the commit subject, | |
| # so the title has to satisfy the same convention. | |
| - name: Lint the pull request title | |
| if: github.event_name == 'pull_request' | |
| env: | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| run: printf '%s\n' "$PR_TITLE" | pnpm exec commitlint --verbose | |
| verify: | |
| name: Verify (Node ${{ matrix.node }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # 20.x is the oldest supported release (`engines.node`), 22.x the | |
| # current LTS line. | |
| node: ["20.x", "22.x"] | |
| steps: | |
| - name: Check out the repository | |
| uses: actions/checkout@v7 | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: 12.21.0 | |
| - name: Set up Node.js ${{ matrix.node }} | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: pnpm | |
| - name: Install the dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Typecheck | |
| run: pnpm typecheck | |
| - name: Build | |
| run: pnpm build | |
| - name: Test | |
| run: pnpm test |