Skip to content

Commit 563c09f

Browse files
committed
Fix the diffbot trigger to read issue/comment body
1 parent 523913d commit 563c09f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/diffBot.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,25 @@ jobs:
1919
uses: actions/github-script@v6
2020
with:
2121
script: |
22-
const commentBody = context.payload.comment.body;
22+
let body = "";
23+
if (context.payload.issue && context.eventName === "issues") {
24+
body = context.payload.issue.body || "";
25+
console.log("Checking issue body...");
26+
} else if (context.payload.comment && context.eventName === "issue_comment") {
27+
body = context.payload.comment.body || "";
28+
console.log("Checking comment body...");
29+
}
2330
const regexScreenshot = /@diff\s+(\S+)\s+(\S+)/; // Match URL + screenshot flag
2431
const regexArtifact = /@diff\s+(\S+)/; // Match only URL
2532
26-
let match = commentBody.match(regexScreenshot);
33+
let match = body.match(regexScreenshot);
2734
if (match) {
2835
core.setOutput('triggered', 'true');
2936
core.setOutput('url', match[1].trim());
3037
core.setOutput('screenshot', match[2].trim());
3138
core.setOutput('mode', 'screenshot');
3239
} else {
33-
match = commentBody.match(regexArtifact);
40+
match = body.match(regexArtifact);
3441
if (match) {
3542
core.setOutput('triggered', 'true');
3643
core.setOutput('url', match[1].trim());

0 commit comments

Comments
 (0)