Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- fix branch name in test details
  • Loading branch information
StephenHodgson authored Oct 18, 2024
1 parent 7acc54f commit 55ad717
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 13 deletions.
14 changes: 10 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58696,6 +58696,8 @@ async function GetProjectDetails() {
let infoPlistContent = plist.parse(fs.readFileSync(infoPlistPath, 'utf8'));
const versionString = infoPlistContent['CFBundleShortVersionString'];
core.info(`Version string: ${versionString}`);
const buildString = infoPlistContent['CFBundleVersion'];
core.info(`Build string: ${buildString}`);
return new XcodeProject_1.XcodeProject(projectPath, projectName, platform, bundleId, projectDirectory, versionString, scheme);
}
async function parseBuildSettings(projectPath, scheme) {
Expand Down Expand Up @@ -59299,19 +59301,23 @@ async function getWhatsNew() {
const branchNameDetails = await execGit(['log', head, '-1', '--format=%d']);
const branchNameMatch = branchNameDetails.match(/\((?<branch>.+)\)/);
let branchName = '';
if (branchNameMatch) {
if (branchNameMatch && branchNameMatch.groups) {
branchName = branchNameMatch.groups.branch;
if (branchName.includes(' -> ')) {
branchName = branchName.split(' -> ')[1];
}
if (branchName.includes(',')) {
branchName = branchName.split(',')[1];
}
if (branchName.includes('origin/')) {
branchName = branchName.split('origin/')[1];
if (branchName.includes('/')) {
branchName = branchName.split('/')[1];
}
}
const commitMessage = await execGit(['log', head, '-1', '--format=%s']);
const commitMessage = await execGit(['log', head, '-1', '--format=%B']);
whatsNew = `[${commitSha.trim()}]${branchName.trim()}\n${commitMessage.trim()}`;
if (whatsNew.length > 4000) {
whatsNew = `${whatsNew.substring(0, 3997)}...`;
}
}
if (whatsNew.length === 0) {
throw new Error('Test details empty!');
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unity-xcode-builder",
"version": "1.1.0",
"version": "1.1.1",
"description": "A GitHub Action to build, archive, and upload Unity exported xcode projects.",
"author": "buildalon",
"license": "MIT",
Expand Down
17 changes: 12 additions & 5 deletions src/xcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ async function GetProjectDetails(): Promise<XcodeProject> {
let infoPlistContent = plist.parse(fs.readFileSync(infoPlistPath, 'utf8'));
const versionString = infoPlistContent['CFBundleShortVersionString'];
core.info(`Version string: ${versionString}`);
const buildString = infoPlistContent['CFBundleVersion'];
core.info(`Build string: ${buildString}`);
return new XcodeProject(
projectPath,
projectName,
Expand Down Expand Up @@ -93,7 +95,8 @@ async function parseBuildSettings(projectPath: string, scheme: string): Promise<
if (!platformName) {
throw new Error('Unable to determine the platform name from the build settings');
}
const bundleId = core.getInput('bundle-id') || matchRegexPattern(buildSettingsOutput, /\s+PRODUCT_BUNDLE_IDENTIFIER = (?<bundleId>[\w.-]+)/, 'bundleId'); if (!bundleId || bundleId === 'NO') {
const bundleId = core.getInput('bundle-id') || matchRegexPattern(buildSettingsOutput, /\s+PRODUCT_BUNDLE_IDENTIFIER = (?<bundleId>[\w.-]+)/, 'bundleId');
if (!bundleId || bundleId === 'NO') {
throw new Error('Unable to determine the bundle ID from the build settings');
}
const platforms = {
Expand Down Expand Up @@ -670,19 +673,23 @@ async function getWhatsNew(): Promise<string> {
const branchNameDetails = await execGit(['log', head, '-1', '--format=%d']);
const branchNameMatch = branchNameDetails.match(/\((?<branch>.+)\)/);
let branchName = '';
if (branchNameMatch) {
if (branchNameMatch && branchNameMatch.groups) {
branchName = branchNameMatch.groups.branch;
if (branchName.includes(' -> ')) {
branchName = branchName.split(' -> ')[1];
}
if (branchName.includes(',')) {
branchName = branchName.split(',')[1];
}
if (branchName.includes('origin/')) {
branchName = branchName.split('origin/')[1];
if (branchName.includes('/')) {
branchName = branchName.split('/')[1];
}
}
const commitMessage = await execGit(['log', head, '-1', '--format=%s']);
const commitMessage = await execGit(['log', head, '-1', '--format=%B']);
whatsNew = `[${commitSha.trim()}]${branchName.trim()}\n${commitMessage.trim()}`;
if (whatsNew.length > 4000) {
whatsNew = `${whatsNew.substring(0, 3997)}...`;
}
}
if (whatsNew.length === 0) {
throw new Error('Test details empty!');
Expand Down

0 comments on commit 55ad717

Please sign in to comment.