Skip to content

KAI Scheduler - Post Coverage Comment #1838

KAI Scheduler - Post Coverage Comment

KAI Scheduler - Post Coverage Comment #1838

# Copyright 2025 NVIDIA CORPORATION
# SPDX-License-Identifier: Apache-2.0
name: KAI Scheduler - Post Coverage Comment
on:
workflow_run:
workflows: ["KAI Scheduler - Pull Request"]
types:
- completed
jobs:
post-coverage-comment:
name: Post Coverage Comment
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
permissions:
contents: read
pull-requests: write
steps:
- name: Download PR number artifact
uses: actions/download-artifact@v4
with:
name: pr-number-for-comment
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Download coverage report artifact
uses: actions/download-artifact@v4
with:
name: coverage-report-for-comment
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Post comment
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const prNumber = fs.readFileSync('pr_number.txt', 'utf8').trim();
const reportBody = fs.readFileSync('coverage-report.txt', 'utf8');
console.log(`reportBody: "${reportBody}"`);
console.log(`prNumber: "${prNumber}"`);
if (reportBody.trim()) {
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
body: reportBody
});
} else {
console.log('Coverage report body is empty. Skipping comment.');
}