Skip to content

Commit

Permalink
Only include f releases. Print all unity versions on response for tes…
Browse files Browse the repository at this point in the history
…t function
  • Loading branch information
AndrewKahr committed Jun 5, 2024
1 parent e36703a commit 1473033
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
6 changes: 5 additions & 1 deletion functions/src/api/testFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export const testFunction = onRequest(
throw new Error('No Unity versions were found.');
}

info = `Found ${versions.length} repo versions and ${unityVersions.length} Unity versions. First Unity Version: ${unityVersions[0].version}, ${unityVersions[0].changeSet}`;
info = `Found ${versions.length} repo versions and ${
unityVersions.length
} Unity versions. Unity Versions: \n${unityVersions
.map((unity) => `${unity.version}:${unity.changeSet}`)
.join('\n')}`;
} catch (error: any) {
info = error.message;
code = 500;
Expand Down
24 changes: 14 additions & 10 deletions functions/src/logic/ingestUnityVersions/scrapeVersions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ export const scrapeVersions = async (): Promise<EditorVersionInfo[]> => {
if (script.textContent) {
const matches = [...script.textContent.matchAll(unity_version_regex)];
if (matches.length > 0) {
return matches.map((match) => {
const [_, major, minor, patch, changeSet] = match;
return {
version: `${major}.${minor}.${patch}`,
major: Number(major),
minor: Number(minor),
patch,
changeSet,
};
});
return matches
.filter((match) => {
return match[4].includes('f');
})
.map((match) => {
const [_, major, minor, patch, changeSet] = match;
return {
version: `${major}.${minor}.${patch}`,
major: Number(major),
minor: Number(minor),
patch,
changeSet,
};
});
}
}
}
Expand Down

0 comments on commit 1473033

Please sign in to comment.