Skip to content

Summarize Checks #438598

Summarize Checks

Summarize Checks #438598

name: "Summarize Checks"
on:
workflow_run:
workflows:
- "Swagger SemanticValidation - Set Status"
- "Swagger ModelValidation - Set Status"
- "Summarize PR Impact"
- "Swagger Avocado - Set Status"
- "Swagger LintDiff - Set Status"
- "SDK Validation Status"
- "TypeSpec Validation"
- "Update Labels"
types:
- completed
pull_request_target: # when a PR is labeled. NOT pull_request, because that would run on the PR branch, not the base branch.
types:
- labeled
- unlabeled
- opened
- synchronize
- reopened
- edited
- ready_for_review
- converted_to_draft
permissions:
actions: read # to inspect workflow_run metadata
contents: read # for actions/checkout
checks: read # for octokit.rest.checks.listForRef
statuses: write # for octokit.rest.repos.getCombinedStatusForRef and octokit.rest.repos.createCommitStatus
issues: write # to post comments via the Issues API
pull-requests: write # to post comments via the Pull Requests API
jobs:
run-summarize-checks:
if: ${{ github.event_name == 'pull_request_target' || github.event.workflow_run.conclusion != 'skipped' }}
name: "Summarize Checks"
runs-on: ubuntu-24.04
steps:
# *** IMPORTANT ***
# For workflows that are triggered by the pull_request_target event, the workflow runs in the
# context of the base of the pull request. You should make sure that you do not check out,
# build, or run untrusted code from the head of the pull request.
- uses: actions/checkout@v4
with:
# Only needs .github folder for automation, not the files in the PR (analyzed in a
# separate workflow).
#
# Uses the .github folder from the PR base branch (pull_request_target trigger),
# or the repo default branch (other triggers).
sparse-checkout: |
.github
# todo: add the npm install ci here for the zod usage in summarize-checks (not currently there)
- id: dump-trigger-metadata
name: Dump Trigger Metadata
uses: actions/github-script@v7
with:
script: |
const { default: dumpTriggerMetadata } =
await import('${{ github.workspace }}/.github/workflows/src/summarize-checks/dump-trigger-metadata.js');
return await dumpTriggerMetadata({ context, core });
- id: summarize-checks
name: Summarize Checks
uses: actions/github-script@v7
with:
script: |
const { default: summarizeChecks } =
await import('${{ github.workspace }}/.github/workflows/src/summarize-checks/summarize-checks.js');
return await summarizeChecks({ github, context, core });
# May be used by downstream workflows
- name: Set job-summary artifact
if: ${{ always() && steps.summarize-checks.outputs.summary }}
uses: actions/upload-artifact@v4
with:
name: job-summary
path: ${{ steps.summarize-checks.outputs.summary }}
# If the file doesn't exist, just don't add the artifact
if-no-files-found: ignore