Skip to content

Commit c4902cc

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

2 files changed

Lines changed: 11 additions & 31 deletions

File tree

.github/workflows/check-files.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,15 @@ jobs:
6161
echo "No new unreachable files found with check_files.py"
6262
fi >> "$GITHUB_STEP_SUMMARY"
6363
64-
# Prepare the output
65-
SUMMARY=$(< "$GITHUB_STEP_SUMMARY")
66-
echo "issue_number=$EVENT_NUMBER" >> "$GITHUB_OUTPUT"
67-
echo "problem_count=$WARNING_COUNT" >> "$GITHUB_OUTPUT"
68-
echo "summary=$SUMMARY" >> "$GITHUB_OUTPUT"
64+
# Prepare the artifacts
65+
mkdir -p ./results
66+
echo "$EVENT_NUMBER" > ./results/id
67+
cp "$GITHUB_STEP_SUMMARY" ./results/summary
68+
echo "$(wc -l < _new-warn.log)" > ./results/problem-count
6969
7070
# Exit with error if there are new warnings
7171
[ "$WARNING_COUNT" -eq "0" ]
7272
7373
- name: Comment
7474
uses: ./.github/workflows/comment.yml
7575
if: always()
76-
with:
77-
issue_number: ${{ steps.check.outputs.issue_number }}
78-
problem_count: ${{ steps.check.outputs.problem_count }}
79-
summary: ${{ steps.check.outputs.summary }}

.github/workflows/comment.yml

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,6 @@ name: "comment"
33

44
on: # yamllint disable-line rule:truthy
55
workflow_call:
6-
inputs:
7-
issue_number:
8-
description: "PR / Issue number to comment on"
9-
required: true
10-
type: number
11-
problem_count:
12-
description: "Number of problems detected"
13-
required: true
14-
type: number
15-
summary:
16-
description: "Text summary that will be posted"
17-
required: true
18-
type: string
196

207
permissions:
218
pull-requests: write # Required to leave a comment on a review
@@ -29,18 +16,15 @@ jobs:
2916
steps:
3017
- name: Update pr with info from other runners
3118
uses: actions/github-script@v7
32-
env:
33-
ISSUE_NUMBER: ${{ inputs.issue_number }}
34-
PROBLEM_COUNT: ${{ inputs.problem_count }}
35-
SUMMARY: ${{ inputs.summary }}
3619
with:
3720
github-token: ${{ secrets.GITHUB_TOKEN }}
3821
script: |
39-
const { env } = require('node:process');
40-
41-
var issue_number = Number(env.ISSUE_NUMBER);
42-
var problem_count = Number(env.PROBLEM_COUNT);
43-
var summary = String(env.SUMMARY);
22+
var fs = require('fs');
23+
var issue_number = Number(fs.readFileSync('./results/id'));
24+
var problem_count = Number(fs.readFileSync(
25+
'./results/problem-count'
26+
));
27+
var summary = String(fs.readFileSync('./results/summary'));
4428
4529
if (problem_count > 0) {
4630
github.rest.issues.createComment({

0 commit comments

Comments
 (0)