Skip to content

Commit 7260012

Browse files
authored
Prevent benchmark action failing check run for fork PRs (#876)
* Try something * Try checking by owner * Print full context * Printing some other stuff * Try creating a gist for forks * Wait why is this broken * I'm dumb * Forget about the gist idea
1 parent 249a365 commit 7260012

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,23 @@ jobs:
116116
117117
const text = `### Lua5.3\n${benchmarkInfoLua.text}\n### LuaJIT\n${benchmarkInfoJIT.text}`;
118118
119-
github.checks.create({
120-
owner: context.repo.owner,
121-
repo: context.repo.repo,
122-
name: "Benchmark results",
123-
head_sha: context.sha,
124-
status: "completed",
125-
conclusion: "neutral",
126-
output: {
127-
title: "Benchmark results",
128-
summary: summary,
129-
text: text
130-
}
131-
});
119+
const pull_request = context.payload.pull_request;
120+
if (pull_request.head.repo.url === pull_request.base.repo.url) {
121+
// This only works if not in a fork.
122+
github.checks.create({
123+
owner: context.repo.owner,
124+
repo: context.repo.repo,
125+
name: "Benchmark results",
126+
head_sha: context.sha,
127+
status: "completed",
128+
conclusion: "neutral",
129+
output: {
130+
title: "Benchmark results",
131+
summary: summary,
132+
text: text
133+
}
134+
});
135+
} else {
136+
console.log(summary);
137+
console.log(text);
138+
}

0 commit comments

Comments
 (0)