Skip to content

Commit e362d6f

Browse files
[Github] Make issue-write workflow support reading from multiple files
This is so that we can read from multiple files emitted by the premerge workflow. Pull Request: llvm#170411
1 parent 562d911 commit e362d6f

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.github/workflows/issue-write-test.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ jobs:
1616
steps:
1717
- name: Write Comment
1818
run: |
19-
echo '[{"body": "This is a comment for testing the issue write workflow"}]' > comments
19+
echo '[{"body": "This is a comment for testing the issue write workflow"}]' > comments-foo
20+
echo '[{"body": "This is another comment for testing the issue write workflow that was placed in a separate file"}]' > comments-bar
2021
- name: Upload Comment
2122
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
2223
with:
23-
name: workflow-args
24+
name: workflow-args-foo
2425
path: |
25-
comments
26+
comments-foo
27+
- name: Upload Comment
28+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
29+
with:
30+
name: workflow-args-bar
31+
path: |
32+
comments-bar

.github/workflows/issue-write.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ jobs:
4747
github-token: ${{ secrets.GITHUB_TOKEN }}
4848
script: |
4949
var fs = require('fs');
50-
const comments = JSON.parse(fs.readFileSync('./comments'));
50+
var comments = []
51+
for (local_file of fs.readdirSync('.')) {
52+
if (local_file.startsWith("comments")) {
53+
comments.push(...JSON.parse(fs.readFileSync(local_file)))
54+
}
55+
}
5156
if (!comments || comments.length == 0) {
5257
return;
5358
}

0 commit comments

Comments
 (0)