Skip to content

Commit a939f42

Browse files
committed
fix
1 parent 058c08d commit a939f42

File tree

3 files changed

+31
-25
lines changed

3 files changed

+31
-25
lines changed

.github/workflows/test.yml

+29-11
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
with:
6161
name: Test262 result
6262
path: |
63+
./tasks/test262/outputs.txt
6364
./tasks/test262/failed.txt
6465
./tasks/test262/stat.txt
6566
# Comment stat.txt to the commit or PR
@@ -72,21 +73,38 @@ jobs:
7273
const path = require('path');
7374
const stat = fs.readFileSync('./tasks/test262/stat.txt', 'utf-8');
7475
const body = stat.slice(0, 50000);
75-
if (context.issue.number) {
76-
github.rest.issues.createComment({
76+
(async () => {
77+
const comments = await github.rest.issues.listComments({
7778
issue_number: context.issue.number,
7879
owner: context.repo.owner,
7980
repo: context.repo.repo,
80-
body
8181
});
82-
} else {
83-
github.rest.repos.createCommitComment({
84-
commit_sha: context.sha,
85-
owner: context.repo.owner,
86-
repo: context.repo.repo,
87-
body
88-
});
89-
}
82+
const existingComment = comments.data.find(comment =>
83+
comment.body.includes('Test262 Result') && comment.user.type === 'Bot'
84+
);
85+
if (existingComment) {
86+
await github.rest.issues.updateComment({
87+
comment_id: existingComment.id,
88+
owner: context.repo.owner,
89+
repo: context.repo.repo,
90+
body
91+
});
92+
} else if (context.issue.number) {
93+
await github.rest.issues.createComment({
94+
issue_number: context.issue.number,
95+
owner: context.repo.owner,
96+
repo: context.repo.repo,
97+
body
98+
});
99+
} else {
100+
await github.rest.repos.createCommitComment({
101+
commit_sha: context.sha,
102+
owner: context.repo.owner,
103+
repo: context.repo.repo,
104+
body
105+
});
106+
}
107+
})();
90108
91109
e2e:
92110
runs-on: ubuntu-latest

tasks/test262/main.js

-14
This file was deleted.

tasks/test262/output.cjs

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ process.stdin.on('end', () => {
3737
}
3838
}
3939

40+
fs.writeFileSync(path.join(__dirname, 'outputs.txt'), input);
41+
4042
const failedList = Object.entries(failedTests).map(([name, message]) => {
4143
return `[${name}](https://github.com/tc39/test262/tree/main/test/${name}): \`${message.trim()}\``;
4244
}).join('\n');

0 commit comments

Comments
 (0)