Skip to content

Comment on PR

Comment on PR #125

Workflow file for this run

name: Comment on PR
on:
workflow_run:
workflows: ["SHASUM summary"]
types:
- completed
jobs:
comment:
permissions:
pull-requests: write
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: download artifact
uses: actions/download-artifact@v4
with:
name: shasum-comment
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
run-id: ${{ github.event.workflow_run.id }}
- name: comment
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
let issue_number = Number(fs.readFileSync('./issue-number', 'utf8').trim());
let comment = fs.readFileSync('./comment', 'utf8').trim();
if (comment.length > 0) {
github.rest.issues.createComment({
issue_number: issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "${{ github.event.pull_request.head.sha }}\n\n" + comment
});
}