Skip to content

Commit 138ca26

Browse files
committed
fix: handle missing GH_ORG_TOKEN gracefully in check-codeowner
1 parent 3837f80 commit 138ca26

3 files changed

Lines changed: 27 additions & 22 deletions

File tree

.github/actions/check-codeowner/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "Check whether the event actor is listed in CODEOWNERS, including t
44
inputs:
55
GH_ORG_TOKEN:
66
description: "Token with read:org scope for resolving team membership"
7-
required: true
7+
required: false
88

99
outputs:
1010
is-codeowner:

.github/actions/check-codeowner/index.js

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/check-codeowner/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@ async function isCodeowner(octokit: Octokit, actor: string): Promise<boolean> {
9393

9494
(async function () {
9595
try {
96-
const token = core.getInput("GH_ORG_TOKEN", { required: true });
96+
const token = core.getInput("GH_ORG_TOKEN");
97+
if (!token) {
98+
core.warning("GH_ORG_TOKEN not set — skipping CODEOWNERS check");
99+
core.setOutput("is-codeowner", "false");
100+
return;
101+
}
97102
const octokit = github.getOctokit(token);
98103

99104
const actor = getActor();

0 commit comments

Comments
 (0)