Skip to content

hasAnyVersionTags and projectPath #317

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
ninetyninereds opened this issue Jan 13, 2022 · 4 comments
Closed

hasAnyVersionTags and projectPath #317

ninetyninereds opened this issue Jan 13, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@ninetyninereds
Copy link
Contributor

Bug description

The function hasAnyVersionTags in the Versioning class runs git through a call to System.run; unlike the more generic git function, which passes projectPath as the cwd parameter, hasAnyVersionTags does not - this breaks builds that check-out the repository to subfolders, since the git command will be run from a parent folder, which is not a git repository, and the call
will fail.

How to reproduce

  1. Create a build workflow that checks out to a different folder than the default (i.e. provide a path in the Checkout action, say call it 'project'),
  2. Provide that path above as the projectPath
  3. Build with the unity-builder action

Keeping all the defaults, the builder will make a call to hasAnyVersionTags and will fail due to the parent folder not being a repository

Expected behavior

Should behave exactly like the git function in Versioning, which passed projectPath as the cwd parameter to System.run.

Additional details

Why is this even important? Say you want to use custom actions in private git repositories - you then need to checkout the action. If you check it out into the game project's repository (i.e. under .github/actions) you're creating a "dirty" branch, which unity-builder will not build. So the best solution is to check the action out in a separate folder, which means checking out the project to a separate folder.
Solution is to add cwd to the call to System.run with projectPath.

@ninetyninereds ninetyninereds added the bug Something isn't working label Jan 13, 2022
@webbertakken
Copy link
Member

Thanks for your bug report.

It's mostly clear what you're getting at. If hasAnyVersionTags doesn't work in subfolders this should be fixed.

That said I'm not quite sure about the provided additional details and using checkout twice in the same workflow is not supported by Github Actions as far as I know.

Say you want to use custom actions in private git repositories - you then need to checkout the action.

you're creating a "dirty" branch, which unity-builder will not build

Generally speaking the action should be either part of your game repo (which you check out either way) or another repo that can be accessed like any other action, which doesn't require checkout. We do have an option called allowDirtyBuild which bypasses the check entirely, but it is not recommended.

Hope this helps.

@ninetyninereds
Copy link
Contributor Author

ninetyninereds commented Jan 20, 2022 via email

@webbertakken
Copy link
Member

Yup agreed. Also as mentioned above;

If hasAnyVersionTags doesn't work in subfolders this should be fixed.

We're definitely open to your suggested changes. Thank you!

@davidmfinol
Copy link
Member

Closed by #323

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants