Skip to content

🚨 • Post Clang-Tidy Review #2503

🚨 • Post Clang-Tidy Review

🚨 • Post Clang-Tidy Review #2503

name: 🚨 • Post Clang-Tidy Review
on:
workflow_run:
workflows: [ 'Clang-Tidy Review' ]
types:
- completed
jobs:
build:
runs-on: ubuntu-latest
name: Post Clang-Tidy Review
steps:
# Download the artifact uploaded by the lint action
- name: Download Clang-Tidy artifact
uses: actions/github-script@v7
with:
script: |
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "clang-tidy-review"
})[0];
const download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
const fs = require('fs');
fs.writeFileSync('${{github.workspace}}/clang-tidy-review.zip', Buffer.from(download.data));
# Unzip the artifact
- name: Unzip artifact
run: unzip clang-tidy-review.zip
# Posts the comments
- name: Post review comments
id: post-review
uses: ZedThree/clang-tidy-review/[email protected]
# If there are any comments, fail the check
- if: steps.post-review.outputs.total_comments > 0
run: exit 1