-
-
Notifications
You must be signed in to change notification settings - Fork 288
Add parameter linux64RemoveExecutableExtension
#726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Allows the end-user to restore the default unity behavior of using the file extension `.x86_64`, instead of no file extension. Preserves the current behavior, to avoid surprise breakage.
📝 WalkthroughWalkthroughAdds a new boolean input Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Action as GitHub Action
participant Input as Input
participant BP as BuildParameters
User->>Action: Trigger workflow
Action->>Input: read linux64RemoveExecutableExtension
Input-->>Action: return true / false
Action->>BP: BuildParameters.create(filename, platform, androidExportType, linux64RemoveExecutableExtension)
note over BP: create() forwards linux64RemoveExecutableExtension to parseBuildFile
BP->>BP: parseBuildFile(filename, platform, androidExportType, linux64RemoveExecutableExtension)
alt platform == StandaloneLinux64 and linux64RemoveExecutableExtension == true
BP-->>Action: return filename (no .x86_64 extension)
else platform == StandaloneLinux64 and linux64RemoveExecutableExtension == false
BP-->>Action: return filename + ".x86_64"
else other platforms
BP-->>Action: existing filename handling (unchanged)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Suggested labels
Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (4)
src/model/input.test.ts (1)
338-349
: Consider adding a fallback-env test to exercise non-core input paths.This strengthens confidence that LINUX64_FILE_EXTENSION (env-var) works when core.getInput is empty.
You could append something like this:
it('falls back to env var LINUX64_FILE_EXTENSION when core input is empty', () => { const original = process.env.LINUX64_FILE_EXTENSION; try { process.env.LINUX64_FILE_EXTENSION = '.x86_64'; jest.spyOn(core, 'getInput').mockReturnValue(''); // force fallback path expect(Input.linux64FileExtension).toBe('.x86_64'); } finally { if (original === undefined) { delete process.env.LINUX64_FILE_EXTENSION; } else { process.env.LINUX64_FILE_EXTENSION = original; } } });src/model/build-parameters.test.ts (1)
107-115
: Use empty string instead of 'n/a' for non-Linux rows to avoid unrealistic values.The property is a plain string and unused outside the Linux branch, but keeping it '' makes the test matrix semantically cleaner.
Apply:
- ${Platform.types.Android} | ${'.apk'} | ${'androidPackage'} | ${'n/a'} - ${Platform.types.Android} | ${'.aab'} | ${'androidAppBundle'} | ${'n/a'} - ${Platform.types.Android} | ${''} | ${'androidStudioProject'} | ${'n/a'} - ${Platform.types.StandaloneWindows} | ${'.exe'} | ${'n/a'} | ${'n/a'} - ${Platform.types.StandaloneWindows64} | ${'.exe'} | ${'n/a'} | ${'n/a'} + ${Platform.types.Android} | ${'.apk'} | ${'androidPackage'} | ${''} + ${Platform.types.Android} | ${'.aab'} | ${'androidAppBundle'} | ${''} + ${Platform.types.Android} | ${''} | ${'androidStudioProject'} | ${''} + ${Platform.types.StandaloneWindows} | ${'.exe'} | ${'n/a'} | ${''} + ${Platform.types.StandaloneWindows64} | ${'.exe'} | ${'n/a'} | ${''}src/model/build-parameters.ts (2)
256-259
: Normalize and validate linux64FileExtension to avoid surprises (leading dot, path separators).Prevents accidental “filenamex86_64” (missing dot) or injection of path separators. Non-breaking for current tests.
Apply:
- if (platform === Platform.types.StandaloneLinux64) { - return `${filename}${linux64FileExtension}`; - } + if (platform === Platform.types.StandaloneLinux64) { + const trimmed = linux64FileExtension.trim(); + if (/[\/\\]/.test(trimmed)) { + throw new Error('Invalid linux64FileExtension: must not contain path separators'); + } + const normalized = trimmed === '' ? '' : (trimmed.startsWith('.') ? trimmed : `.${trimmed}`); + return `${filename}${normalized}`; + }
256-259
: Add a Linux64 predicate to Platform (optional)There isn’t currently a
Platform.isLinux64
(orPlatform.isLinux
) helper insrc/model/platform.ts
. To stay consistent with the existingPlatform.isWindows
andPlatform.isAndroid
predicates—and for easier future extensions—you might add one:In
src/model/platform.ts
:static isLinux64(platform: string): boolean { return platform === Platform.types.StandaloneLinux64; }Then in
src/model/build-parameters.ts
(around line 256):- if (platform === Platform.types.StandaloneLinux64) { + if (Platform.isLinux64(platform)) { return `${filename}${linux64FileExtension}`; }This refactor is optional but will keep your platform checks uniform.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (2)
dist/index.js
is excluded by!**/dist/**
dist/index.js.map
is excluded by!**/dist/**
,!**/*.map
📒 Files selected for processing (4)
src/model/build-parameters.test.ts
(1 hunks)src/model/build-parameters.ts
(3 hunks)src/model/input.test.ts
(1 hunks)src/model/input.ts
(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
src/model/build-parameters.test.ts (1)
src/model/input.ts (3)
targetPlatform
(80-82)androidExportType
(162-164)linux64FileExtension
(285-287)
src/model/build-parameters.ts (1)
src/model/input.ts (2)
androidExportType
(162-164)linux64FileExtension
(285-287)
🔇 Additional comments (4)
src/model/input.ts (1)
285-288
: LGTM: new linux64FileExtension input is correctly exposed and defaults to empty string.Matches existing Input getter patterns and preserves current behavior by default.
src/model/input.test.ts (1)
338-349
: LGTM: tests cover default and explicit values for linux64FileExtension.Clear, minimal, and consistent with other Input getter tests.
src/model/build-parameters.test.ts (1)
106-127
: LGTM: matrix now validates Linux64 filename behavior with and without extension.Good coverage tying Input.linux64FileExtension into BuildParameters.create and parse logic.
src/model/build-parameters.ts (1)
104-109
: Correctly threading linux64FileExtension into parseBuildFile.This keeps the extension decision centralized in parseBuildFile and preserves default behavior when the input is empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
action.yml (2)
271-272
: Clarify accepted formats in the description (leading dot vs no dot).Minor wording tweak to preempt ambiguity about whether users should include the leading dot. If your parsing already normalizes both, reflect that here; if not, this makes the expectation explicit.
Apply this diff to clarify:
- description: - 'Specify the file extension of the executable when building for StandaloneLinux64. For example, ".x86_64"' + description: + 'Specify the file extension of the executable when building for StandaloneLinux64. For example, ".x86_64". Leave empty to omit. You may include or omit the leading dot; the builder will handle both.'
268-273
: Remember to update docs and usage examples.Once merged, add this input to README/action usage matrix and provide a snippet for enabling Unity’s default “.x86_64” extension.
Happy to draft the documentation snippet and a minimal example workflow if you’d like.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
action.yml
(1 hunks)
🔇 Additional comments (1)
action.yml (1)
268-273
: LGTM: New linux64FileExtension input is well-scoped and consistent.Name, placement, and defaults align with existing inputs. Description clearly communicates the intent and example.
and the rest that this entails. This PR should probably be squashed before merging, with attention paid to the commit message.
linux64FileExtension
linux64RemoveExecutableExtension
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/model/input.ts (1)
285-289
: Normalize boolean parsing to be case/whitespace-insensitiveUsers sometimes pass True/TRUE or include spaces in workflow YAML. Normalizing here avoids subtle surprises and mirrors a more robust pattern.
static get linux64RemoveExecutableExtension(): boolean { - const input = Input.getInput('linux64RemoveExecutableExtension') ?? 'true'; - - return input === 'true'; + const raw = (Input.getInput('linux64RemoveExecutableExtension') ?? 'true').trim().toLowerCase(); + return raw === 'true'; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (2)
dist/index.js
is excluded by!**/dist/**
dist/index.js.map
is excluded by!**/dist/**
,!**/*.map
📒 Files selected for processing (5)
action.yml
(1 hunks)src/model/build-parameters.test.ts
(1 hunks)src/model/build-parameters.ts
(3 hunks)src/model/input.test.ts
(1 hunks)src/model/input.ts
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- src/model/input.test.ts
- action.yml
- src/model/build-parameters.ts
- src/model/build-parameters.test.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/model/input.ts (1)
src/model/index.ts (1)
Input
(19-19)
🔇 Additional comments (2)
src/model/input.ts (2)
285-289
: LGTM: adds boolean input with backward-compatible defaultThe getter correctly defaults to removing the extension (true), which preserves current behavior and avoids breaking changes.
285-289
: No lingering linux64FileExtension — repo uses linux64RemoveExecutableExtensionSearch results show no occurrences of linux64FileExtension; the code, tests and action metadata use linux64RemoveExecutableExtension:
- action.yml — linux64RemoveExecutableExtension (lines ~268–270)
- src/model/input.ts — getter linux64RemoveExecutableExtension (lines ~285–289)
- src/model/input.test.ts — tests for linux64RemoveExecutableExtension (around lines ~338–351)
- src/model/build-parameters.ts & src/model/build-parameters.test.ts — consume/mock linux64RemoveExecutableExtension
- dist/index.js — compiled references to linux64RemoveExecutableExtension
Conclusion: no changes required in code/docs to remove an old name — you can consider updating the PR title (if it still says linux64FileExtension) to match linux64RemoveExecutableExtension.
making a couple of the AI nitpicks more visible:
Felt redundant to me, then again
Feels like this would be better off in a separate PR that normalizes the boolean parsing everywhere. As-is, I'm using the same pattern that is used everywhere else in the file. |
Changes
linux64RemoveExecutableExtension
.x86_64
, instead of no file extension.Related Issues
Successful Workflow Run Link
PRs don't have access to secrets so you will need to provide a link to a successful run of the workflows from your own
repo.
Checklist
code of conduct
in the documentation repo)
Summary by CodeRabbit
New Features
Tests