Fixing Unity 6 Support in unity-activate and compiled action bundle.#109
Fixing Unity 6 Support in unity-activate and compiled action bundle.#109webbertakken merged 2 commits intogame-ci:mainfrom
Conversation
📝 WalkthroughWalkthroughUpdated the version pattern regex in Changes
Possibly related issues
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/model/image-tag.ts`:
- Around line 29-31: The regex returned by static get versionPattern currently
has an unanchored alternation (the trailing "|3$" applies only to the right-hand
side) — update versionPattern so the start (^) and end ($) anchors apply to the
entire alternation by grouping the alternatives (e.g., wrap the two alternatives
in a single group or non-capturing group) and place ^ and $ around that group;
if the literal "3" was intended as a valid full-match alternative, include it
inside the grouped alternation, otherwise remove the stray "|3" alternative.
| static get versionPattern() { | ||
| return /^20\d{2}\.\d\.\w{3,4}|3$/; | ||
| return /^(20|60)\d{2}\.\d\.\w{3,4}|3$/; | ||
| } |
There was a problem hiding this comment.
Fix broken regex alternation — |3$ creates an unanchored and overly permissive pattern
The | operator has the lowest precedence of all regex operators — it splits the entire expression into everything to its left and everything to its right. The current regex:
/^(20|60)\d{2}\.\d\.\w{3,4}|3$/
is parsed as two independent alternatives:
^(20|60)\d{2}\.\d\.\w{3,4}— no trailing$, so"6000.0.0f1GARBAGE"passes3$— any string ending in3passes (e.g.,"notaversion3","2023")
This was a latent bug in the original regex (/^20\d{2}\.\d\.\w{3,4}|3$/) that this PR carries forward. This is the classic pitfall where ^hello|goodbye$ doesn't require the full string to match either word — because | is evaluated last, after ^ and $.
The |3$ fragment appears unintentional. The fix is to wrap both anchors around the full expression:
🐛 Proposed fix
- return /^(20|60)\d{2}\.\d\.\w{3,4}|3$/;
+ return /^(20|60)\d{2}\.\d\.\w{3,4}$/;If the |3 was intentional (e.g., to also accept a bare "3"), use grouping to scope the alternation correctly:
- return /^(20|60)\d{2}\.\d\.\w{3,4}|3$/;
+ return /^((20|60)\d{2}\.\d\.\w{3,4}|3)$/;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| static get versionPattern() { | |
| return /^20\d{2}\.\d\.\w{3,4}|3$/; | |
| return /^(20|60)\d{2}\.\d\.\w{3,4}|3$/; | |
| } | |
| static get versionPattern() { | |
| return /^(20|60)\d{2}\.\d\.\w{3,4}$/; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/model/image-tag.ts` around lines 29 - 31, The regex returned by static
get versionPattern currently has an unanchored alternation (the trailing "|3$"
applies only to the right-hand side) — update versionPattern so the start (^)
and end ($) anchors apply to the entire alternation by grouping the alternatives
(e.g., wrap the two alternatives in a single group or non-capturing group) and
place ^ and $ around that group; if the literal "3" was intended as a valid
full-match alternative, include it inside the grouped alternation, otherwise
remove the stray "|3" alternative.
|
Thanks. Gracias. |
https://github.com/NicolasChicunque/unity-activate
Summary: Fixing Unity 6 Support in unity-activate
Problem
The game-ci/unity-activate@v2 action fails with an Invalid version "6000.x.xf1" error because its internal Regex only supports versions starting with "20".
Solution
I created a fork and manually updated the version validation logic to include the 6000 series (Unity 6).
Step 1: Code Modification
Locate the file src/model/image-tag.ts and update the versionPattern() Regex to accept both 2000 and 6000 series.
Modified Regex in src/model/image-tag.ts
Step 2: Compiling the Bundle
Since GitHub Actions run from the dist/ folder, editing the .ts file is not enough. I used @vercel/ncc to compile the final bundle, bypassing TypeScript type errors caused by the environment.
Compilation Command
Step 3: Deployment
Commit the updated dist/index.js file. If the repository has strict linting/formatting hooks (Husky/Prettier) that prevent the commit, use the --no-verify flag.
Git Commands
Step 4: Workflow Update
Finally, point the .yml file to the fixed fork and branch. Ensure the Unity version used has a corresponding Docker image available.
Workflow YAML
Summary by CodeRabbit