How to get updates when new code or version changes from github repo?

so Im completely lost when it comes to understanding how github repo’s work.

Is there a way to get notifications on when a replacement is added to the same folder on the devs repo?

Im concerned that I will eventually be using an outdated version of a device type/app.

1 Like

I’m with you in the confusion, but a little optimistic.

If the particular Repo is properly set to track or sync, there are lots of ways to get notifications, including RSS and email.

I don’t quite understand why so much is thrown into one repository… It’s not really how Git is supposed to be used, yet alternative structures are complicated too.

It’s a little hard to filter for changes on particular files this way… I think… But maybe not.

Looking around on the web and trying to understand “Forking” repos? Not a clue what that actually does.

Adding someones repos to my own to follow, not a clue what that actually does and why I cant get that to work.

I was barely able to get the smartthings repo connected so I could even get the API configurable.

Im a IT guy, but coding is not my thing.

3 Likes

Check out the docs on Github integration. Forking and syncing are covered pretty well. A fork is your local copy of the code. You will need to keep it in sync with the upstream “master” copy if you want to stay on the latest version. This is not a process that happens automatically without some scripting on your part.

http://docs.smartthings.com/en/latest/tools-and-ide/github-integration.html

2 Likes

I “postponed” my deep dive into the GitHub integration when I was trying to follow why both a “fork” and an “upstream sync” is required.

Why can’t updates be fetched directly from the shared repository? Why is a “fork” required if you have no intention of committing any personal updates (or making pull requests)?

Since SmartThings only integrates with **GitHub **based repositories instead of any Git compatible storage, this extra forking forces us into managing code on a platform other than whatever our personal preference maybe (e.g., locally stored repository in Windows, Unix, or another service like Bitbucket, etc.).

I don’t think a fork/sync is required, it’s just the standard method used when working with github. I think this iteration of the integration is aimed more towards developers than as a method for developers to distribute their code. That said, I was able to add another user’s repository and install SmartApps directly from there. That would remove the need to sync. It’s a cumbersome way to go about it, but the files will always be the latest version they publish if the developer is pushing his or her changes upstream. Forking allows you as a developer to pull down the code and make changes. If those changes might be beneficial you can push your changes back for inclusion in the master branch. The main reason you would want to fork a repo is if you wanted changes and you did not want those changes to be wiped out every time the original author pushed a new version up. Fetching only the changes will allow you to maintain a distinct copy that is able to recieve updates and fixes as well.

Maybe @Jim and @slagle can shed some light on the best practices when it comes to Github and the best practices when using it with SmartThings

1 Like

This is really a really helpful clarification, and makes a lot of sense.

Indeed, I think there are a substantial set of users who “only” want to fetch code in a “read-only” fashion and have no intention of making personal updates (nor pushing these updates or making pull-requests).

For those people, if a personal fork can be avoided (seems like it can…), then it would be beneficial to offer (and document) this somewhat simplified option of directly attaching to the source repo.

1 Like

This goes against all things Git and the reason we want people to fork. That said… a fork is not required. As long as you have read access to a repo you can add it to your github integration.

1 Like

Yup… I definitely understand there are conventions for Git and GitHub that exist for good reasons.

I suggesting it is worth figuring out what compromises make sense for folks that want only certain specific benefits of the GitHub integration (i.e., like OP @Turb02’s desire for automatic or near automatic device type and SmartApp updates), while minimizing complexity, if we thoroughly consider that perhaps a fork is not necessary for read-only purposes.

I’m insufficiently experienced with Git and the integration to make that “call”, but appreciate the consideration thereof.

Oh… and @Turb02 … I’m happy to offer some help to walk through the recommended GitHub steps with you and explain the “forking” and such to the best of my knowledge. Sometimes it helps to explore the process together.

Bit busy this week, but let’s see how this develops and you can Private Message me anytime.

2 Likes

Totally, the only concern here is being able to push back to the source. Can create some headaches for the data owner if pushes are made. I’d be interested to see what happens if someone pushes back to source that they don’t own. Since someone could technically push and merge if the source is open it makes it dangerous and degrades the sustainability of the source.

If someone wants to test, add my repo, make a small change (add a comment or something) and see if you can directly commit changes. I don’t see why you couldn’t. It may error out, which would be a good thing, but I’ve never tried so I don’t know.

namespace: tslagle13
repo: SmartThingsPersonal

It was my understanding that only items created in the ide would be visible to pull from. SmartThingsPublic for example. Early on in the github integration @pstuart and I tried to pull from a prexisting repo and it showed no available items.

It needs to follow the folder structure that we use. Look at my repo for an example. The top three will show in the IDE the rest won’t.

2 Likes

I understand that there’s a folder structure that will allow integration into the SmartThings IDE and I have that working for a personal repo as well as the forked SmartThings repo.

However, MANY developers in the community have repros that do not conform to the required folder structure - especially if they have been using github long before there was integration. It would seem that MOST of the community developed apps/device types I use are in this category.

So… what methods are you guys using to integrate code from non-conforming repros into the IDE? I fork the repo in GitHub, get notified of changes, then cut-n-paste into the IDE. Is this the best way to go about it? It’s very cumbersome and is also very hard to contribute upstream as I have to cut-n-paste the source from the IDE back into my fork on github to create a pull request.

Am I missing something here?

tagging @slagle @johnconstantelo and @brianwilson for advise

1 Like

The integration is not meant to be an automatic updating mechanism. Git just does not work that way. It is meant to allow for collaboration between people working on the same codeset.

If you want to make it available on github just publsh it from the IDE and it will conform to our standard and will be available in your IDE to pull and push.

This probably won’t ever be the case. Git it is very specific and follows very specific conventions, and for good reason. We follow those conventions.

The devs in question will need to make their repo follow our file path in order to allow this type of integration.

Thanks @slagle, but let me make sure I understand a key thing here

let’s say you and I want to co-write a smartapp. I have a fork of the smart things repository and I start the app in the SmartThings IDE and I sync that to my fork of the SmartThings Public repo. Don’t I then need to create a pull request to have that pulled into the master ST repo in order for you to be able to then see it?

Edit: Let me see if I have this correct

For multiple people to collaborate using IDE integration:

  1. Person A creates a smartthings-complient repo and starts the app
  2. Person B forks person A’s repo
  3. They each add that repo to the ST IDE and work on the app, publishing changes, merging, etc.

Now they are done and want to contribute it to the SmartThings Public repo:

  1. Fork the Smartthings Public repo (if not already)
  2. Create a “New” app
  3. Cut-n-paste code from the app created above into the new app
  4. Commit it to the local fork of ST Public
  5. Make a pull request to ST Public

Do I have this right?

If you are working directly off the master branch yes. You should never be working off the master branch. you should create a new branch on the fork of the ST repo, add that branch to anyones IDE that is working on the project. once the project is done you can create a PR from the origin branch to the upstream master branch.

1 Like

Ok… (sorry for all the questions, but I feel like there’s s secret club and everyone’s sworn to be as vague as possible)

So, if I see that you are working on something and you are working on it in a branch off of SmartThingsPublic, GitHub will not let me fork your SmartThingsPublic because I already have a fork of SmartThingsPublic (if you try to fork some else’s SmartThingsPublic, then it just takes you to your already-forked SmartThingsPublic). Doesn’t this make it actually impossible to use Git in a collaborative manner (unless we both push changes to the master SmartThingsPublic)?

I believe if you fork a repo that has the same name as an existing one in your account, it will rename the new repo with a number attached (i.e. SmartThingsPublic-1).

That’s not what’s happening for me - it just takes me to my own repo of the same name - it doesn’t fork the one I want.