generated from PrismarineJS/prismarine-template
-
Notifications
You must be signed in to change notification settings - Fork 6
46 lines (43 loc) · 1.4 KB
/
make-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
42
43
44
45
46
# Done this way because of https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
name: Comment on the pull request
# read-write repo token
# access to secrets
on:
workflow_run:
workflows: ["PR-WORKFLOW"]
types:
- completed
jobs:
comment:
runs-on: ubuntu-latest
if: >
${{ github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 18.x
- name: Download artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: ci.yml
run_id: ${{github.event.workflow_run.id }}
name: packets
path: packets
- run: npm i minecraft-data
- run: cd packets && node ../.github/workflows/md-comment-maker.js
- name: 'Comment on PR'
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
var fs = require('fs');
var issue_number = Number(fs.readFileSync('./packets/NR', 'utf-8'));
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue_number,
body: fs.readFileSync('./packets/README.md', 'utf-8')
});