Skip to content

Conversation

StephenHodgson
Copy link
Member

@StephenHodgson StephenHodgson commented Aug 7, 2025

  • updated xcode version handling
  • refactored action to be more robust and reliable

@Copilot Copilot AI review requested due to automatic review settings August 7, 2025 22:31
@StephenHodgson StephenHodgson requested a review from a team as a code owner August 7, 2025 22:31
Copilot

This comment was marked as outdated.

@StephenHodgson StephenHodgson marked this pull request as draft August 27, 2025 20:53
@StephenHodgson StephenHodgson marked this pull request as ready for review August 27, 2025 20:53
@StephenHodgson StephenHodgson requested a review from Copilot August 28, 2025 17:48
Copilot

This comment was marked as outdated.

Copy link

@Copilot 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 PR upgrades the unity-xcode-builder package to version 1.3.4 with significant refactoring to improve code organization, error handling, and CI workflow structure.

  • Major code refactoring with improved separation of concerns and utility functions
  • Enhanced error handling and debugging output throughout the codebase
  • Restructured CI workflows to use a matrix-based approach with external configuration

Reviewed Changes

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

Show a summary per file
File Description
package.json Version bump to 1.3.4 and dependency updates
src/index.ts Simplified main logic by extracting Xcode version handling
src/xcode.ts Major refactoring with new functions, improved error handling, and better code organization
src/utilities.ts Added new utility functions for file operations and pattern matching
src/XcodeProject.ts Updated constructor parameter order and added new properties
.github/workflows/validate.yml Restructured to use job matrix with external configuration
.github/workflows/build.yml New workflow file for build execution
.github/workflows/build-options.json Configuration file for build matrix options

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

throw new Error('Failed to get Xcode version!');
}

const selectedXcodeVersionString = xcodeVersionMatch.groups.version;
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

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

Potential undefined access. The groups property could be undefined even if the match succeeds. Add a null check before accessing the version property.

Copilot uses AI. Check for mistakes.

await exec('sudo', ['xcodebuild', '-license', 'accept'], { ignoreReturnCode: true });
await exec('sudo', ['xcodebuild', '-runFirstLaunch']);

return semver.coerce(xcodeVersionString);
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

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

When xcodeVersionString is undefined (no input provided), this will return null from semver.coerce(), but the function return type is SemVer. Should return semver.coerce(selectedXcodeVersionString) instead.

Suggested change
return semver.coerce(xcodeVersionString);
return semver.coerce(selectedXcodeVersionString);

Copilot uses AI. Check for mistakes.


if (installedXcodeVersions.length === 0 || !xcodeVersionString.includes('latest')) {
if (installedXcodeVersions.length === 0 || !installedXcodeVersions.includes(xcodeVersionString)) {
throw new Error(`Xcode version ${xcodeVersionString} is not installed! You will need to install this is a step before this one.`);
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

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

Grammatical error: 'install this is a step' should be 'install this in a step'.

Suggested change
throw new Error(`Xcode version ${xcodeVersionString} is not installed! You will need to install this is a step before this one.`);
throw new Error(`Xcode version ${xcodeVersionString} is not installed! You will need to install this in a step before this one.`);

Copilot uses AI. Check for mistakes.

throw new Error(`Failed to resolve: ${pattern}`);
}

return group ? match.groups?.[group] : match[1];
Copy link
Preview

Copilot AI Sep 9, 2025

Choose a reason for hiding this comment

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

Potential undefined access. When group is provided but match.groups is undefined, this will return undefined instead of throwing an error as intended by the function logic.

Suggested change
return group ? match.groups?.[group] : match[1];
if (group) {
if (!match.groups || !(group in match.groups)) {
throw new Error(`Group '${group}' not found in pattern: ${pattern}`);
}
return match.groups[group];
} else {
return match[1];
}

Copilot uses AI. Check for mistakes.

@StephenHodgson StephenHodgson merged commit 9342b48 into main Sep 15, 2025
30 checks passed
@StephenHodgson StephenHodgson deleted the development branch September 15, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant