Skip to content
This repository was archived by the owner on May 1, 2026. It is now read-only.

feat: add --skip-build-number-bump flag#524

Merged
WcaleNieWolny merged 7 commits into
mainfrom
feat/skip-build-number-bump
Feb 25, 2026
Merged

feat: add --skip-build-number-bump flag#524
WcaleNieWolny merged 7 commits into
mainfrom
feat/skip-build-number-bump

Conversation

@WcaleNieWolny
Copy link
Copy Markdown
Contributor

@WcaleNieWolny WcaleNieWolny commented Feb 25, 2026

Summary

  • Add --skip-build-number-bump flag to build request, build credentials save, and build credentials update commands
  • When set, builds use the version already in the project files instead of auto-incrementing
  • Also readable from SKIP_BUILD_NUMBER_BUMP environment variable
  • Follows existing credential pipeline pattern (like BUILD_OUTPUT_UPLOAD_ENABLED)
  • Logs informational messages during credentials save about whether auto-bump is enabled or disabled (matching PR feat: default BUILD_OUTPUT_UPLOAD_ENABLED to false, log defaults #521 pattern)

Files changed

  • src/schemas/build.ts — added SKIP_BUILD_NUMBER_BUMP to credentials schema + request options schema
  • src/index.ts — registered --skip-build-number-bump option on build request, credentials save, and credentials update commands
  • src/build/credentials-command.ts — wired flag through save/update logic with logging
  • src/build/request.ts — passes flag through build request credentials
  • src/build/credentials.ts — reads SKIP_BUILD_NUMBER_BUMP from environment variables

Companion PR

  • Cap-go/capgo_builder — fastlane template guards (iOS + Android)

Test plan

  • build credentials save --platform android --keystore ... --skip-build-number-bump saves SKIP_BUILD_NUMBER_BUMP=true, logs it
  • build credentials save --platform android --keystore ... (without flag) logs default (auto-bump enabled)
  • build credentials update --skip-build-number-bump updates only that field
  • build request --platform ios --skip-build-number-bump passes through to credentials
  • Set env var SKIP_BUILD_NUMBER_BUMP=true picked up during credential merging

Summary by CodeRabbit

  • New Features
    • Added --skip-build-number-bump and --no-skip-build-number-bump CLI flags to build request and credentials save commands. Users can now explicitly control whether build numbers are automatically incremented during builds. The preference is stored and applied consistently across all future builds.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

Introduces support for a --skip-build-number-bump CLI flag and corresponding environment variable to control automatic build number increments during the build process. Changes propagate through credential handling, CLI definitions, and schema definitions.

Changes

Cohort / File(s) Summary
CLI Option Definitions
src/index.ts
Added --skip-build-number-bump and --no-skip-build-number-bump flags to build request and credentials save command definitions.
Credential Command Processing
src/build/credentials-command.ts
Added skipBuildNumberBump option to SaveCredentialsOptions; processes option in SaveCredentialsCommand and UpdateCredentialsCommand, setting SKIP_BUILD_NUMBER_BUMP credential accordingly. Updated cross-platform option detection logic.
Credential Environment Loading
src/build/credentials.ts
Added support for SKIP_BUILD_NUMBER_BUMP environment variable in loadCredentialsFromEnv, parsed via parseOptionalBoolean.
Build Request Handling
src/build/request.ts
Added CLI option parsing for --skip-build-number-bump flag in native build request flow; sets SKIP_BUILD_NUMBER_BUMP credential in merged credentials payload.
Schema Extensions
src/schemas/build.ts
Added optional SKIP_BUILD_NUMBER_BUMP: string field to BuildCredentials and optional skipBuildNumberBump: boolean field to BuildRequestOptions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A flag to skip the build increment's dance,
Through credentials and CLI, we grant the chance—
One hop, one skip, and the number stays still,
From environment to request, by developer's will! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a new --skip-build-number-bump flag to the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/skip-build-number-bump

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@WcaleNieWolny WcaleNieWolny marked this pull request as ready for review February 25, 2026 09:36
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a --skip-build-number-bump flag to the build credential and request commands, allowing users to opt out of automatic build number/version code incrementing. When set, builds will use the version already present in project files instead of auto-incrementing.

Changes:

  • Added SKIP_BUILD_NUMBER_BUMP credential field to schema and credential pipeline
  • Registered --skip-build-number-bump CLI option on build request, credentials save, and credentials update commands
  • Implemented informational logging during credentials save about auto-bump status (enabled/disabled)

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/schemas/build.ts Added SKIP_BUILD_NUMBER_BUMP to buildCredentialsSchema and skipBuildNumberBump to buildRequestOptionsSchema
src/index.ts Registered --skip-build-number-bump option on build request, credentials save, and credentials update commands
src/build/request.ts Added logic to pass skipBuildNumberBump flag through CLI credentials to build request
src/build/credentials.ts Added environment variable loading for SKIP_BUILD_NUMBER_BUMP
src/build/credentials-command.ts Implemented flag handling in save and update commands with informational logging; updated cross-platform options detection

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/build/credentials.ts Outdated
Comment thread src/build/credentials-command.ts Outdated
Comment thread src/build/credentials-command.ts Outdated
Comment thread src/build/request.ts Outdated
- Normalize env var with parseOptionalBoolean (credentials.ts)
- Use !== undefined check in save, update, and request commands
  so users can re-enable auto-increment via --no-skip-build-number-bump
- Remove log on explicit set, keep only default log (PR #521 pattern)
- Add --no-skip-build-number-bump option to all three commands
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
10.3% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@WcaleNieWolny WcaleNieWolny merged commit c932e42 into main Feb 25, 2026
17 of 19 checks passed
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/build/request.ts (1)

962-964: Same misleading parseOptionalBoolean error message as in credentials.ts

If options.skipBuildNumberBump were somehow a non-bool string with an unrecognised value, the thrown error would still reference output-upload. Apply the same optionName parameterisation fix suggested for credentials.ts.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/build/request.ts` around lines 962 - 964, The code sets
cliCredentials.SKIP_BUILD_NUMBER_BUMP using
parseOptionalBoolean(options.skipBuildNumberBump) which can throw an error
referencing the wrong option name; update the call to pass the option name so
the thrown error mentions the correct flag (e.g., call parseOptionalBoolean with
the second parameter 'skipBuildNumberBump'), keeping the ternary assignment to
cliCredentials.SKIP_BUILD_NUMBER_BUMP unchanged and targeting the
parseOptionalBoolean invocation that processes options.skipBuildNumberBump.
🧹 Nitpick comments (4)
src/build/credentials.ts (1)

240-242: Misleading error message from parseOptionalBoolean when called for SKIP_BUILD_NUMBER_BUMP

parseOptionalBoolean (line 89 of credentials.ts) throws:

'output-upload must be true/false (examples: --output-upload, --output-upload false)'

If a user sets SKIP_BUILD_NUMBER_BUMP=maybe, they'll see an error mentioning output-upload, which is confusing. This same pre-existing issue now affects a second caller.

Consider parameterising the option name:

♻️ Proposed fix
-export function parseOptionalBoolean(value: boolean | string | undefined): boolean {
+export function parseOptionalBoolean(value: boolean | string | undefined, optionName = 'output-upload'): boolean {
   if (value === undefined)
     return true
   if (typeof value === 'boolean')
     return value

   const normalized = value.trim().toLowerCase()
   if (normalized === 'true' || normalized === '1' || normalized === 'yes')
     return true
   if (normalized === 'false' || normalized === '0' || normalized === 'no')
     return false

-  throw new Error('output-upload must be true/false (examples: --output-upload, --output-upload false)')
+  throw new Error(`${optionName} must be true/false (examples: --${optionName}, --${optionName} false)`)
 }

Then at line 241:

-    credentials.SKIP_BUILD_NUMBER_BUMP = parseOptionalBoolean(skipBuildNumberBump) ? 'true' : 'false'
+    credentials.SKIP_BUILD_NUMBER_BUMP = parseOptionalBoolean(skipBuildNumberBump, 'skip-build-number-bump') ? 'true' : 'false'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/build/credentials.ts` around lines 240 - 242, The parseOptionalBoolean
helper currently emits a hardcoded error mentioning "output-upload", so when
called for SKIP_BUILD_NUMBER_BUMP it shows the wrong option name; update
parseOptionalBoolean to accept an optional optionName parameter (preserving the
current default to avoid breaking callers) and use that optionName in the thrown
error message, then change the call in credentials.ts that sets
credentials.SKIP_BUILD_NUMBER_BUMP to call
parseOptionalBoolean(skipBuildNumberBump, 'skip-build-number-bump') (and update
any other callers to pass an appropriate optionName) so the error references the
correct flag.
src/build/credentials-command.ts (3)

108-113: Noisy default-info log fires on every credentials save that omits the flag

The ℹ️ --skip-build-number-bump not specified, build number will be auto-incremented (default) line will appear on every credentials save invocation that doesn't explicitly pass the flag — including users who have never heard of this option. Unlike the --output-upload default log (which explains a concrete change: "defaulting to false"), this message describes a server-side default and adds noise for the common case.

Consider only logging when the flag is present, or suppress the info line altogether and rely on --help documentation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/build/credentials-command.ts` around lines 108 - 113, The info log
message about the default for --skip-build-number-bump is noisy and should not
print on every credentials save; update the block that handles
options.skipBuildNumberBump and credentials.SKIP_BUILD_NUMBER_BUMP so it only
logs when the flag is explicitly provided (e.g., when
options.skipBuildNumberBump is defined and parsed), otherwise suppress the info
line entirely (remove the log.info call in the else branch) to avoid spamming
users; reference the conditional using options.skipBuildNumberBump and the
assignment to credentials.SKIP_BUILD_NUMBER_BUMP to locate the change.

503-505: Vague cross-platform error message leaves users guessing

When a user runs build credentials update --skip-build-number-bump (without --platform), they hit the hasCrossPlatformOptions branch, but the error message says only:

"These options require --platform to be set (ios or android)."

Because --skip-build-number-bump doesn't look like a platform-specific option, the message is opaque. Consider naming the triggering option:

♻️ Proposed improvement
-      else if (hasCrossPlatformOptions) {
-        log.error('These options require --platform to be set (ios or android).')
+      else if (hasCrossPlatformOptions) {
+        const which = [
+          options.outputUpload !== undefined && '--output-upload',
+          options.outputRetention !== undefined && '--output-retention',
+          options.skipBuildNumberBump !== undefined && '--skip-build-number-bump',
+        ].filter(Boolean).join(', ')
+        log.error(`${which} require(s) --platform to be set (ios or android).`)
         exit(1)
       }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/build/credentials-command.ts` around lines 503 - 505, The error message
in the hasCrossPlatformOptions branch is too vague; update the branch handling
around hasCrossPlatformOptions in credentials-command.ts so the log.error
includes the specific option name(s) that triggered the cross-platform
restriction (for example the --skip-build-number-bump flag) instead of a generic
message; obtain the offending option names from the same detection logic used to
set hasCrossPlatformOptions and include them in the error string (e.g., "Option
--skip-build-number-bump requires --platform to be set (ios or android)"), then
call exit(1) as before.

489-489: SKIP_BUILD_NUMBER_BUMP is a behavior flag but must be set per-platform — document the dual-run requirement

Because credentials are stored per-platform (ios / android), a user who wants to skip build-number bumping for both platforms must run credentials update (or credentials save) twice — once with --platform ios and once with --platform android. This is non-obvious since the flag is not a secret and behaves the same on both platforms.

Adding a log hint after saving/updating when skipBuildNumberBump is set would reduce confusion:

if (options.skipBuildNumberBump !== undefined) {
  credentials.SKIP_BUILD_NUMBER_BUMP = parseOptionalBoolean(options.skipBuildNumberBump) ? 'true' : 'false'
  log.info('ℹ️  SKIP_BUILD_NUMBER_BUMP applies per-platform. Run credentials update for the other platform too if needed.')
}

Also applies to: 553-555

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/build/credentials-command.ts` at line 489, When
options.skipBuildNumberBump is used update the save/update flow to both set
credentials.SKIP_BUILD_NUMBER_BUMP ('true'/'false') and emit an informational
log that the flag is per-platform and requires running credentials update/save
for the other platform too; locate the code around the hasCrossPlatformOptions
declaration (const hasCrossPlatformOptions) and the blocks that handle
options.skipBuildNumberBump (including the similar occurrence further down), set
credentials.SKIP_BUILD_NUMBER_BUMP from
parseOptionalBoolean(options.skipBuildNumberBump) and add a log.info call that
says the flag applies per-platform and to run the command again for the other
platform.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/build/request.ts`:
- Around line 962-964: The code sets cliCredentials.SKIP_BUILD_NUMBER_BUMP using
parseOptionalBoolean(options.skipBuildNumberBump) which can throw an error
referencing the wrong option name; update the call to pass the option name so
the thrown error mentions the correct flag (e.g., call parseOptionalBoolean with
the second parameter 'skipBuildNumberBump'), keeping the ternary assignment to
cliCredentials.SKIP_BUILD_NUMBER_BUMP unchanged and targeting the
parseOptionalBoolean invocation that processes options.skipBuildNumberBump.

---

Nitpick comments:
In `@src/build/credentials-command.ts`:
- Around line 108-113: The info log message about the default for
--skip-build-number-bump is noisy and should not print on every credentials
save; update the block that handles options.skipBuildNumberBump and
credentials.SKIP_BUILD_NUMBER_BUMP so it only logs when the flag is explicitly
provided (e.g., when options.skipBuildNumberBump is defined and parsed),
otherwise suppress the info line entirely (remove the log.info call in the else
branch) to avoid spamming users; reference the conditional using
options.skipBuildNumberBump and the assignment to
credentials.SKIP_BUILD_NUMBER_BUMP to locate the change.
- Around line 503-505: The error message in the hasCrossPlatformOptions branch
is too vague; update the branch handling around hasCrossPlatformOptions in
credentials-command.ts so the log.error includes the specific option name(s)
that triggered the cross-platform restriction (for example the
--skip-build-number-bump flag) instead of a generic message; obtain the
offending option names from the same detection logic used to set
hasCrossPlatformOptions and include them in the error string (e.g., "Option
--skip-build-number-bump requires --platform to be set (ios or android)"), then
call exit(1) as before.
- Line 489: When options.skipBuildNumberBump is used update the save/update flow
to both set credentials.SKIP_BUILD_NUMBER_BUMP ('true'/'false') and emit an
informational log that the flag is per-platform and requires running credentials
update/save for the other platform too; locate the code around the
hasCrossPlatformOptions declaration (const hasCrossPlatformOptions) and the
blocks that handle options.skipBuildNumberBump (including the similar occurrence
further down), set credentials.SKIP_BUILD_NUMBER_BUMP from
parseOptionalBoolean(options.skipBuildNumberBump) and add a log.info call that
says the flag applies per-platform and to run the command again for the other
platform.

In `@src/build/credentials.ts`:
- Around line 240-242: The parseOptionalBoolean helper currently emits a
hardcoded error mentioning "output-upload", so when called for
SKIP_BUILD_NUMBER_BUMP it shows the wrong option name; update
parseOptionalBoolean to accept an optional optionName parameter (preserving the
current default to avoid breaking callers) and use that optionName in the thrown
error message, then change the call in credentials.ts that sets
credentials.SKIP_BUILD_NUMBER_BUMP to call
parseOptionalBoolean(skipBuildNumberBump, 'skip-build-number-bump') (and update
any other callers to pass an appropriate optionName) so the error references the
correct flag.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between db7a6f0 and 3368f94.

📒 Files selected for processing (5)
  • src/build/credentials-command.ts
  • src/build/credentials.ts
  • src/build/request.ts
  • src/index.ts
  • src/schemas/build.ts

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants