Search Unity

Unity's version control component has been upgraded to Plastic SCM.

Please consider providing an API like GitHub

Discussion in 'Unity Collaborate' started by jwvanderbeck, May 27, 2017.

  1. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    825
    Hi Unity Collab team!

    Please consider providing developers with an API similiar to what GitHub has. These are extremely useful in automating some tasks.

    Specifically in my case we are trying to use Collab instead of Git and GitHub and one huge issue we are running into is release notes. With GitHub whenever we commit, if we want the commit to show up in release notes we format it a special way along with the information we want to be in the release notes. Then when we cut a release, we run a Python script that uses the GitHub API to parse the commit messages since the last release, extract those special formatted messages, and generate a first draft nearly complete release notes for the release.

    Now that we are using Collab we have to manually build those release notes by trolling the Collab commits.
     
  2. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @jwvanderbeck! I spoke with one of our devs and there is a way that you can grab your project's complete history, minus the file change sets (that's a different command). I'll walk you through how to go about grabbing the comments from your project's history.

    1) First you'll need to get your "access_token" for your project. Open a terminal or command prompt and enter the following:

    curl -v -H 'Content-Type: application/json' -X POST -d '{"username":"INSERT_EMAIL","password":"INSERT_PASSWORD","grant_type":"password"}' https://core.cloud.unity3d.com/api/login

    Be sure to swap out the INSERT_EMAIL and INSERT_PASSWORD with the ones for your account. Near the bottom you will see "access_token" and "refresh_token". You want to use the "access_token" for the next call.
    DO NOT SAVE these tokens anywhere as they will give anyone full access to your project for at least an hour before they expire. Please use them responsibly.

    2) Now take the "access_token" and the UPID of your project and put them into the following command:

    curl -v -H 'Authorization: Bearer INSERT_ACCESS_TOKEN_FROM_LOGIN' 'https://collab.cloud.unity3d.com/api/projects/INSERT_UNITY_PROJECT_ID/branches/master/revisions' | python -m json.tool

    This will return your project's history, along with the comments for each revision.

    I hope this helps you to write up your release notes. Let me know if you have any questions.
     
  3. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    825
    Oh very interesting! I'll take a look at this as soon as I get a chance.

    Thanks!
     
  4. Knoxx

    Knoxx

    Joined:
    Aug 16, 2014
    Posts:
    2
    Hi Unity Collab Team,

    I was wondering whilst on the topic of Git API is it possible to run a update/pull from command line. We currently have an internal build server (Jenkins CI) and I was wondering if there is anyway of updating from an editor script or command line. Or if there is a better way could you explain or point me in the right direction?

    Regards,

    Knoxx
     
  5. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @Knoxx! At the moment, Collab does not expose the API necessary to run with build systems like Jenkins.

    However, Collab is designed to work seamlessly with Cloud Build, a Unity Service that allows projects to be built remotely and shared among teammates and testers. You can learn more about Cloud Build here, but it's really easy to use and most of its awesome features are available for free! If you have further questions on how to use Collab with Cloud Build, you can ask on their forums here. I hope that answers your question!
     
  6. Knoxx

    Knoxx

    Joined:
    Aug 16, 2014
    Posts:
    2
    @ryanc-unity , Thank you for your answer, I will look into Cloud Build.

    Regards,
    Knoxx
     
    Ryan-Unity likes this.
  7. CozyBryan

    CozyBryan

    Joined:
    Sep 15, 2014
    Posts:
    7
    Hey @ryanc-unity, these tips are really neat!
    Any chance of getting a clean Scripting API specifically for Unity Editor scripting?

    It would be great to be able to have Editor plugins read change history, or be able to commit/revert files.
     
  8. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @Monkokio! We can certainly look into adding Collab API that can be used for Editor scripting. Thank you for the suggestion.

    If you don't mind my asking, in what ways would you like to improve the Collab user experience if you could write a plugin for it? We're always open to suggestions on UI and UX improvements that users would like to see and would be happy to take them into consideration.
     
  9. CozyBryan

    CozyBryan

    Joined:
    Sep 15, 2014
    Posts:
    7
    @ryanc-unity I can think of a few things that would be nice:
    - Right-click to revert an individual file
    - Mention a user in a Publish comment (using the @ symbol) - which gives them a pop-up alert next time they sync
    - Lock a file from being used by others. (this would require an API to push & pull individual lock folders/files )
    - An interface to submit a selection of modified files (currently can only submit all or one)
    - A custom (compact) Collab history view. (there is a ton of extra vertical whitespace)
     
    Genebris likes this.
  10. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    These are great suggestions. You may be happy to hear that the option to revert and publish individual or a selection of edits has been added to 2017.1. You can right click on any selection of modified assets and revert, publish, or resolve conflicts for them.

    I'll pass the rest of these on to our UI team and see if they can discuss these ideas with you.
     
  11. jwvanderbeck

    jwvanderbeck

    Joined:
    Dec 4, 2014
    Posts:
    825
    I would add to this, a more customized commit message entry that allows a team member to enter in changes in such a way that meshes with our build notes system, and the ability to run a script in Editor to build those notes rather than an external process as mentioned in the original post.
     
  12. 99crusader

    99crusader

    Joined:
    Apr 21, 2014
    Posts:
    7
    Is there an update to this somewhere that I'm missing? I'm also looking at automating patch notes using my collab comments, but I'm not sure how to access that data. I tried the above steps, but I am not seeing the access_token after entering the command in cmd.
     
    Lucy_roll likes this.