---
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Lint PR Code Base

on:
  pull_request:
    branches: [master, main]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read # read repository contents

# No workflow-level `env:` and no NPM_TOKEN: a secret placed there reaches
# every step, including third-party actions, and linting needs no npm
# credential (publishing authenticates via OIDC).

jobs:
  Linter:
    name: PR Lint
    runs-on: ubuntu-latest
    timeout-minutes: 15
    environment: ci
    permissions:
      contents: read # read repository contents
      issues: write # comment on the pull request
      packages: read # read GitHub Packages
      pull-requests: write # post the lint and yarn.lock comments
      statuses: write # report lint status on the commit

    steps:
      - name: Checkout
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          persist-credentials: false

      - name: Install and enable corepack
        shell: sh
        run: corepack enable

      - name: Yarn Lock Changes
        uses: Simek/yarn-lock-changes@59f47ee499424d2c2437c5aebf863b5c6d50a5bc # v0.14.1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Run PR Lint
        # https://github.com/ivuorinen/actions
        uses: ivuorinen/actions/pr-lint@94a4f68a6b95ecc1677fbcac1683119fd869adf7 # v2026.07.04
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
