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

Quelle  olean_report_wf_run.yaml  Sprache: unbekannt

 
Spracherkennung für: .yaml vermutete Sprache: Algol {Algol[46] Fortran[36] Mizar[32]} [Methode: maximale Elemente, drei Dimensionen]

# olean report (workflow_run)
# Privileged counterpart of olean_report.yaml.
#
# Downloads the bridge artifact produced by olean_report.yaml and posts (or
# updates) the olean diff as a comment on the PR.  This workflow runs with
# pull-requests: write permission so it can post comments even when the
# triggering workflow ran in an unprivileged fork context.
name: olean report (workflow_run)

on:
  workflow_run:
    workflows: ["olean report"]
    types:
      - completed

permissions:
  actions: read
  contents: read
  issues: read # for `verify` on issue comments
  pull-requests: write

jobs:
  report:
    runs-on: ubuntu-latest
    # Only for successful producer runs: if a job that ran PR code took the artifact's name,
    # `emit` failed, and the one artifact left is not ours (see olean_report.yaml).
    if: ${{ github.repository == '
leanprover-community/mathlib4' && github.event.workflow_run.conclusion == 'success' }}
    steps:
      - name: Consume bridge artifact
        id: bridge
        uses: leanprover-community/privilege-escalation-bridge/consume@120e98bbb1e9438be8973be645ef67e9cddc39ba # v2.1.0
        with:
          token: ${{ github.token }}
          artifact: workflow-data
          source_workflow: olean report
          require_event: issue_comment
          # The producer emits from a job that runs no PR code. `verify` additionally fetches
          # the triggering comment and its PR from the API, and the next step checks that the
          # comment is the olean report request that started the producer run. The comment
          # body comes from the job that ran PR code, so it is only ever posted to that PR.
          verify: true
          fail_on_missing: false
          extract: |
            pr_number=verified.pr.number
            comment=verified.trigger.body
            comment_created_at=verified.trigger.created_at
            run_created_at=run.created_at

      # `verify` accepts any comment by the user who started the producer run from the 24 hours
      # before it. Narrow that to an `!olean_report` request made shortly before the run.
      - name: Check the triggering comment
        if: steps.bridge.outputs.pr_number != '
'
        env:
          COMMENT: ${{ steps.bridge.outputs.comment }}
          COMMENT_CREATED_AT: ${{ steps.bridge.outputs.comment_created_at }}
          RUN_CREATED_AT: ${{ steps.bridge.outputs.run_created_at }}
        run: |
          # same trigger pattern as in olean_report.yaml
          if ! printf '
%s' "${COMMENT}" | grep -qE '^!olean_report'
          then
            echo "::error::The triggering comment is not an olean report request."
            exit 1
          fi
          age=$(( $(date -d "${RUN_CREATED_AT}" +%s) - $(date -d "${COMMENT_CREATED_AT}" +%s) ))
          echo "
The comment was posted ${age}s before the producer run was created."
          if [ "${age}" -gt 3600 ]
          then
            echo "::error::The triggering comment is more than an hour older than the producer run. Post \`!olean_report\` again."
            exit 1
          fi

      - name: Find existing olean-report comment
        if: steps.bridge.outputs.pr_number != ''
        uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4
        id: find-comment
        with:
          issue-number: ${{ steps.bridge.outputs.pr_number }}
          comment-author: 'github-actions[bot]'
          body-includes: '## Olean diff'

      - name: Post or update olean-report comment
        if: steps.bridge.outputs.pr_number != ''
        uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v4
        with:
          comment-id: ${{ steps.find-comment.outputs.comment-id }}
          issue-number: ${{ steps.bridge.outputs.pr_number }}
          body-path: .bridge/comment_body.md
          edit-mode: replace

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