Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Lean/Mathlib/.github/workflows/     Datei vom 15.10.2026 mit Größe 4 kB image not shown  

Quelle  check_pr_titles.yaml  Sprache: unbekannt

 
Spracherkennung für: .yaml vermutete Sprache: MT940 {MT940[34] SQL[34] Masm[30]} [Methode: maximale Elemente, drei Dimensionen]

name: Check PR titles

on:
  pull_request_target:
    types:
      - opened
      - reopened
      - edited
      - ready_for_review

# Limit permissions for GITHUB_TOKEN for the entire workflow
permissions:
  contents: read
  pull-requests: write  # Only allow PR comments/labels
  # All other permissions are implicitly 'none'

jobs:
  check_title:
    if: (github.repository == 'leanprover-community/mathlib4') && (github.event.pull_request.state == 'open') && (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'ready_for_review' || (github.event.action == 'edited' && github.event.changes.title))
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
        with:
          ref: master
      - name: Configure Lean
        uses: leanprover/lean-action@fe408643ea7367d8c0404a8be3975bb145f5fb64 # v1.7.0
        with:
          auto-config: false
          use-github-cache: false
          use-mathlib-cache: false

      - name: check the PR title format
        id: pr-title-check
        if: github.event.pull_request.draft == false && github.event.pull_request.base.ref == '
master'
        env:
          TITLE: ${{ github.event.pull_request.title }}
          PR_LABELS: ${{ toJson(github.event.pull_request.labels) }}
        run: |
          set -o pipefail
          echo "$TITLE"

          # Skip check if title starts with "[Merged by Bors] - "
          if [[ "$TITLE" == "[Merged by Bors] - "* ]]; then
            echo "Skipping check for Bors-merged PR"
            exit 0
          fi

          label_names=$(echo "$PR_LABELS" | jq -r '.[].name')
          echo "$label_names"

          # build command so build lines don'
t pollute `output` below
          lake build check-title-labels

          set +e
          # Capture output and exit code
          output=$(lake exe check-title-labels --labels "$label_names" "$TITLE" 2>&1)
          exit_code=$?
          set -e

          if [ $exit_code -eq 0 ]; then
            echo "Check passed"
          else
            # Set the output for use in subsequent steps
            {
              echo "errors<<EOF"
              echo "$output"
              echo "EOF"
            } | tee -a "$GITHUB_OUTPUT"
            exit "$exit_code"
          fi

      - name: Add comment to fix PR title
        uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5
        if: failure() && steps.pr-title-check.outputs.errors
        with:
          header: 'PR Title Check'
          message: |
            ### �� PR Title Needs Formatting
            Please update the title to match our [commit style conventions](https://leanprover-community.github.io/contribute/commit.html).

            Errors from script:
            ```
            ${{ steps.pr-title-check.outputs.errors }}
            ```

            <details>
            <summary>Details on the required title format</summary>

            The title should fit the following format:
            ```
            <kind>(<optional-scope>): <subject>
            ```
            `<kind>` is:

            - `feat` (feature)
            - `fix` (bug fix)
            - `doc` (documentation)
            - `style` (formatting, missing semicolons, ...)
            - `refactor`
            - `test` (when adding missing tests)
            - `chore` (maintain)
            - `perf` (performance improvement, optimization, ...)
            - `ci` (changes to continuous integration, repo automation, ...)

            `<optional-scope>` is a name of module or a directory which contains changed modules.
            This is not necessary to include, but may be useful if the `<subject>` is insufficient.
            The `Mathlib` directory prefix is always omitted.
            For instance, it could be

            - Data/Nat/Basic
            - Algebra/Group/Defs
            - Topology/Constructions

            `<subject>` has the following constraints:

            - do not capitalize the first letter
            - no dot(.) at the end
            - use imperative, present tense: "change" not "changed" nor "changes"
            </details>

      - name: Add comment that PR title is fixed
        if: steps.pr-title-check.outcome == 'success'
        uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5
        with:
          header: 'PR Title Check'
          # should do nothing if a 'PR Title Check' comment does not exist
          only_update: true
          message: |
            ### ✅ PR Title Formatted Correctly
            The title of this PR has been updated to match our [commit style conventions](https://leanprover-community.github.io/contribute/commit.html).
            Thank you!

[Dauer der Verarbeitung: 0.5 Sekunden, vorverarbeitet 2026-11-18]