Fix vercel build
This commit is contained in:
committed by
pullfrog[bot]
parent
84df6bbfb0
commit
280bb7ef15
@@ -138319,21 +138319,35 @@ function setupGitConfig() {
|
|||||||
const repoDir = process.cwd();
|
const repoDir = process.cwd();
|
||||||
log.info("\xBB setting up git configuration...");
|
log.info("\xBB setting up git configuration...");
|
||||||
try {
|
try {
|
||||||
execSync2('git config --local user.email "team@pullfrog.com"', {
|
let currentEmail = "";
|
||||||
cwd: repoDir,
|
try {
|
||||||
stdio: "pipe"
|
currentEmail = execSync2("git config user.email", {
|
||||||
});
|
cwd: repoDir,
|
||||||
execSync2('git config --local user.name "pullfrog"', {
|
stdio: "pipe",
|
||||||
cwd: repoDir,
|
encoding: "utf-8"
|
||||||
stdio: "pipe"
|
}).trim();
|
||||||
});
|
} catch {
|
||||||
|
}
|
||||||
|
const shouldSetDefaults = !currentEmail || currentEmail === "github-actions[bot]@users.noreply.github.com";
|
||||||
|
if (shouldSetDefaults) {
|
||||||
|
execSync2('git config --local user.email "team@pullfrog.com"', {
|
||||||
|
cwd: repoDir,
|
||||||
|
stdio: "pipe"
|
||||||
|
});
|
||||||
|
execSync2('git config --local user.name "pullfrog"', {
|
||||||
|
cwd: repoDir,
|
||||||
|
stdio: "pipe"
|
||||||
|
});
|
||||||
|
log.debug("\xBB git user configured (using defaults)");
|
||||||
|
} else {
|
||||||
|
log.debug(`\xBB git user already configured (${currentEmail}), skipping`);
|
||||||
|
}
|
||||||
if (!process.env.GITHUB_ACTIONS) {
|
if (!process.env.GITHUB_ACTIONS) {
|
||||||
execSync2('git config --local credential.helper ""', {
|
execSync2('git config --local credential.helper ""', {
|
||||||
cwd: repoDir,
|
cwd: repoDir,
|
||||||
stdio: "pipe"
|
stdio: "pipe"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
log.debug("\xBB git configuration set successfully (scoped to repo)");
|
|
||||||
} catch (error50) {
|
} catch (error50) {
|
||||||
log.warning(
|
log.warning(
|
||||||
`Failed to set git config: ${error50 instanceof Error ? error50.message : String(error50)}`
|
`Failed to set git config: ${error50 instanceof Error ? error50.message : String(error50)}`
|
||||||
|
|||||||
+30
-10
@@ -29,20 +29,41 @@ export function setupTestRepo(options: SetupOptions): void {
|
|||||||
/**
|
/**
|
||||||
* Setup git configuration to avoid identity errors
|
* Setup git configuration to avoid identity errors
|
||||||
* Uses --local flag to scope config to the current repo only
|
* Uses --local flag to scope config to the current repo only
|
||||||
|
* Only sets defaults if not already configured (respects workflow config)
|
||||||
*/
|
*/
|
||||||
export function setupGitConfig(): void {
|
export function setupGitConfig(): void {
|
||||||
const repoDir = process.cwd();
|
const repoDir = process.cwd();
|
||||||
log.info("» setting up git configuration...");
|
log.info("» setting up git configuration...");
|
||||||
try {
|
try {
|
||||||
// Use --local to scope config to this repo only, preventing leakage to user's global config
|
// check current config - only set defaults if not configured or using generic bot
|
||||||
execSync('git config --local user.email "team@pullfrog.com"', {
|
let currentEmail = "";
|
||||||
cwd: repoDir,
|
try {
|
||||||
stdio: "pipe",
|
currentEmail = execSync("git config user.email", {
|
||||||
});
|
cwd: repoDir,
|
||||||
execSync('git config --local user.name "pullfrog"', {
|
stdio: "pipe",
|
||||||
cwd: repoDir,
|
encoding: "utf-8",
|
||||||
stdio: "pipe",
|
}).trim();
|
||||||
});
|
} catch {
|
||||||
|
// not configured
|
||||||
|
}
|
||||||
|
|
||||||
|
const shouldSetDefaults =
|
||||||
|
!currentEmail || currentEmail === "github-actions[bot]@users.noreply.github.com";
|
||||||
|
|
||||||
|
if (shouldSetDefaults) {
|
||||||
|
execSync('git config --local user.email "team@pullfrog.com"', {
|
||||||
|
cwd: repoDir,
|
||||||
|
stdio: "pipe",
|
||||||
|
});
|
||||||
|
execSync('git config --local user.name "pullfrog"', {
|
||||||
|
cwd: repoDir,
|
||||||
|
stdio: "pipe",
|
||||||
|
});
|
||||||
|
log.debug("» git user configured (using defaults)");
|
||||||
|
} else {
|
||||||
|
log.debug(`» git user already configured (${currentEmail}), skipping`);
|
||||||
|
}
|
||||||
|
|
||||||
// disable credential helper to prevent macOS keychain prompts when using x-access-token
|
// disable credential helper to prevent macOS keychain prompts when using x-access-token
|
||||||
// only needed locally - GitHub Actions doesn't have this issue
|
// only needed locally - GitHub Actions doesn't have this issue
|
||||||
if (!process.env.GITHUB_ACTIONS) {
|
if (!process.env.GITHUB_ACTIONS) {
|
||||||
@@ -51,7 +72,6 @@ export function setupGitConfig(): void {
|
|||||||
stdio: "pipe",
|
stdio: "pipe",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
log.debug("» git configuration set successfully (scoped to repo)");
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// If git config fails, log warning but don't fail the action
|
// If git config fails, log warning but don't fail the action
|
||||||
// This can happen if we're not in a git repo or git isn't available
|
// This can happen if we're not in a git repo or git isn't available
|
||||||
|
|||||||
Reference in New Issue
Block a user