diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b63973439..aeccb2d319 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ This is the log of notable changes to EAS CLI and related packages. ### ๐Ÿงน Chores +- Throw error if custom build config is gitignored. ([#2123](https://github.com/expo/eas-cli/pull/2123) by [@szdziedzic](https://github.com/szdziedzic)) + ## [5.9.1](https://github.com/expo/eas-cli/releases/tag/v5.9.1) - 2023-11-20 ### ๐Ÿ› Bug fixes diff --git a/packages/eas-cli/src/build/runBuildAndSubmit.ts b/packages/eas-cli/src/build/runBuildAndSubmit.ts index 58b23213ed..15b6e61375 100644 --- a/packages/eas-cli/src/build/runBuildAndSubmit.ts +++ b/packages/eas-cli/src/build/runBuildAndSubmit.ts @@ -143,7 +143,11 @@ export async function runBuildAndSubmitAsync( {}; for (const buildProfile of buildProfiles) { validateBuildProfileVersionSettings(buildProfile, easJsonCliConfig); - const maybeMetadata = await validateCustomBuildConfigAsync(projectDir, buildProfile.profile); + const maybeMetadata = await validateCustomBuildConfigAsync({ + projectDir, + profile: buildProfile.profile, + vcsClient, + }); if (maybeMetadata) { customBuildConfigMetadataByPlatform[toAppPlatform(buildProfile.platform)] = maybeMetadata; } diff --git a/packages/eas-cli/src/project/customBuildConfig.ts b/packages/eas-cli/src/project/customBuildConfig.ts index 87dff85f84..7b46dc2ab6 100644 --- a/packages/eas-cli/src/project/customBuildConfig.ts +++ b/packages/eas-cli/src/project/customBuildConfig.ts @@ -5,14 +5,21 @@ import chalk from 'chalk'; import fs from 'fs-extra'; import path from 'path'; +import { Client } from '../vcs/vcs'; + export interface CustomBuildConfigMetadata { workflowName?: string; } -export async function validateCustomBuildConfigAsync( - projectDir: string, - profile: BuildProfile -): Promise { +export async function validateCustomBuildConfigAsync({ + profile, + projectDir, + vcsClient, +}: { + projectDir: string; + profile: BuildProfile; + vcsClient: Client; +}): Promise { if (!profile.config) { return undefined; } @@ -24,6 +31,13 @@ export async function validateCustomBuildConfigAsync( `Custom build configuration file ${chalk.bold(relativeConfigPath)} does not exist.` ); } + if (await vcsClient.isFileIgnoredAsync(relativeConfigPath)) { + throw new Error( + `Custom build configuration file ${chalk.bold( + relativeConfigPath + )} is ignored by your version control system. Remove it from the ignore list to successfully create custom build.` + ); + } try { const config = await readAndValidateBuildConfigAsync(configPath, {