Skip to content

Commit 749bb84

Browse files
committed
fixup! fixup! ci(comment): make workflow reusable
1 parent c4902cc commit 749bb84

3 files changed

Lines changed: 29 additions & 37 deletions

File tree

.github/actions/comment/action.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
name: "comment"
3+
description: "Comment on a given pull request or issue"
4+
5+
runs:
6+
using: "composite"
7+
steps:
8+
- name: Update pr with info from other runners
9+
uses: actions/github-script@v7
10+
if: ${{ github.event.workflow_run.event == 'pull_request' }}
11+
with:
12+
github-token: ${{ secrets.GITHUB_TOKEN }}
13+
script: |
14+
var fs = require('fs');
15+
var issue_number = Number(fs.readFileSync('./results/id'));
16+
var problem_count = Number(fs.readFileSync(
17+
'./results/problem-count'
18+
));
19+
var summary = String(fs.readFileSync('./results/summary'));
20+
21+
if (problem_count > 0) {
22+
github.rest.issues.createComment({
23+
owner: context.repo.owner,
24+
issue_number: issue_number,
25+
repo: context.repo.repo,
26+
body: summary
27+
});
28+
}

.github/workflows/check-files.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@ jobs:
7171
[ "$WARNING_COUNT" -eq "0" ]
7272
7373
- name: Comment
74-
uses: ./.github/workflows/comment.yml
74+
uses: ./.github/actions/comment
7575
if: always()

.github/workflows/comment.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)