-
Notifications
You must be signed in to change notification settings - Fork 157
38 lines (35 loc) · 1.29 KB
/
shasum-summary.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
name: comment a SHASUM summary for each changed release
on:
pull_request:
branches: [ "main" ]
jobs:
comment-summary:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event.pull_request.commits }}
- name: show changed files
run: git diff --no-commit-id --name-only ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
- name: run shasum-summary
run: python3 contrib/shasum-summary/main.py ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} > comment
- name: show comment
run: cat comment
- uses: actions/github-script@v7
with:
script: |
const fs = require('node:fs');
fs.readFile('comment', 'utf8', (err, comment) => {
if (err) {
console.error(err);
return;
}
if (comment.length > 0) {
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: "${{ github.event.pull_request.head.sha }}\n\n" + comment
});
}
});