Skip to content

Commit d2accd3

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. Reviewers: tstellar, cmtice Reviewed By: cmtice Pull Request: llvm/llvm-project#170411
1 parent b13b41a commit d2accd3

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
@@ -17,10 +17,17 @@ jobs:
1717
steps:
1818
- name: Write Comment
1919
run: |
20-
echo '[{"body": "This is a comment for testing the issue write workflow"}]' > comments
20+
echo '[{"body": "This is a comment for testing the issue write workflow"}]' > comments-foo
21+
echo '[{"body": "This is another comment for testing the issue write workflow that was placed in a separate file"}]' > comments-bar
2122
- name: Upload Comment
2223
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
2324
with:
24-
name: workflow-args
25+
name: workflow-args-foo
2526
path: |
26-
comments
27+
comments-foo
28+
- name: Upload Comment
29+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
30+
with:
31+
name: workflow-args-bar
32+
path: |
33+
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)