Skip to content

Official Images Updates Comment #28

Official Images Updates Comment

Official Images Updates Comment #28

name: Official Images Updates Comment
on:
workflow_run:
workflows: ["Official Images Updates"]
types:
- completed
permissions:
actions: read
pull-requests: write
jobs:
comment:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
name: pr-comment-data
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Post comment
uses: actions/github-script@v9
with:
script: |
const fs = require('fs');
const prNumber = fs.readFileSync('pr_number.txt', 'utf8').trim();
const diff = fs.readFileSync('diff.txt', 'utf8').trim();
if (!diff) {
console.log('No diff found, skipping comment.');
return;
}
const body = `<details>
<summary>Library file diff (ignoring commit IDs)</summary>
\`\`\`diff
${diff}
\`\`\`
</details>`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: parseInt(prNumber),
body: body
});