forked from ethereum/staking-deposit-cli
-
Notifications
You must be signed in to change notification settings - Fork 5
41 lines (39 loc) · 1.39 KB
/
comment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Safely comment on the PR - https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
name: Comment on pull request
run-name: commenting on PR by ${{ github.actor }}
on:
workflow_run:
workflows: [ "ci-runner" ]
types:
- completed
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@v4
with:
name: results
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Comment on PR'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
const issueNumberPath = './issue_number'
if (!fs.existsSync(issueNumberPath)) {
console.log("Coverage artifacts were not downloaded, succeeding early");
return;
}
var issueNumber = Number(fs.readFileSync(issueNumberPath));
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: fs.readFileSync('./coverage-text-report').toString()
});