Skip to content

Commit

Permalink
chore: fix ci passing when no EXCLUDED_FILES
Browse files Browse the repository at this point in the history
  • Loading branch information
obeys committed Dec 12, 2024
1 parent 9d2754e commit 78c59b5
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .github/empty-string-checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,24 @@ const token = process.env.GITHUB_TOKEN;
const [owner, repo] = process.env.GITHUB_REPOSITORY?.split("/") || [];
const pullNumber = process.env.GITHUB_PR_NUMBER || process.env.PULL_REQUEST_NUMBER || "0";
const baseRef = process.env.GITHUB_BASE_REF;
const excludeEnv = process.env.EXCLUDED_FILES;
const excludedFiles: string[] = [];

if (process.env.EXCLUDED_FILES) {
if (!token || !owner || !repo || pullNumber === "0" || !baseRef || excludeEnv === undefined) {
core.setFailed("Missing required environment variables.");
process.exit(1);
}

// Only process excludeEnv if it has content
if (excludeEnv.length > 0) {
excludedFiles.push(
...process.env.EXCLUDED_FILES.split("\n")
...excludeEnv
.split("\n")
.map((file) => file.trim())
.filter(Boolean)
);
}

if (!token || !owner || !repo || pullNumber === "0" || !baseRef) {
core.setFailed("Missing required environment variables.");
process.exit(1);
}

const octokit = new Octokit({ auth: token });
const git = simpleGit();

Expand Down

0 comments on commit 78c59b5

Please sign in to comment.