Skip to content

Commit

Permalink
add: GitHub Action commenting a summary on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
0xB10C committed May 3, 2024
1 parent dcb80c3 commit 090b0fd
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
38 changes: 38 additions & 0 deletions .github/workflows/shasum-summary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
});
}
});
2 changes: 1 addition & 1 deletion contrib/touched-files-check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ fn check(touched_files: &str) -> Result<(Vec<&str>, HashSet<&str>), String> {
(l.next().unwrap(), l.next().unwrap())
};
println!("Touched file: {status} {file}");
if ["README.md", ".cirrus.yml", "contrib/"]
if ["README.md", ".cirrus.yml", "contrib/", ".github/"]
.iter()
.any(|ignore| file.starts_with(ignore))
{
Expand Down

0 comments on commit 090b0fd

Please sign in to comment.