mirror of
https://github.com/oven-sh/bun
synced 2026-02-13 20:39:05 +00:00
ci: Fix changed files detection for forks
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
getCommitMessage,
|
||||
getLastSuccessfulBuild,
|
||||
getMainBranch,
|
||||
getRepositoryOwner,
|
||||
getTargetBranch,
|
||||
isBuildkite,
|
||||
isFork,
|
||||
@@ -370,7 +371,7 @@ async function main() {
|
||||
}
|
||||
|
||||
console.log("Checking changed files...");
|
||||
const baseRef = getCommit();
|
||||
const baseRef = isFork() ? `${getRepositoryOwner()}:${getCommit()}` : getCommit();
|
||||
console.log(" - Base Ref:", baseRef);
|
||||
const headRef = lastBuild?.commit_id || getTargetBranch() || getMainBranch();
|
||||
console.log(" - Head Ref:", headRef);
|
||||
|
||||
@@ -376,6 +376,20 @@ export function getRepository(cwd) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} [cwd]
|
||||
* @returns {string | undefined}
|
||||
*/
|
||||
export function getRepositoryOwner(cwd) {
|
||||
const repository = getRepository(cwd);
|
||||
if (repository) {
|
||||
const [owner] = repository.split("/");
|
||||
if (owner) {
|
||||
return owner;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} [cwd]
|
||||
* @returns {string | undefined}
|
||||
|
||||
Reference in New Issue
Block a user