@ssmirr,
Dr. Heckman opened a ticket with us to help resolve some issues with this script not functioning as expected on GitHub Enterprise. She says you have gotten the script to work as expected on GitHub.com but were not able to reproduce your results on Enterprise.
Scanning through, the procedure I found that you're using to add repositories to a team lacks the optional parameter for specifying permission
. The value of this parameter can be: push
, pull
or admin
. If unspecified, the team's permission
attribute will be used to determine what the default is. By default, this permission is set to push
(write) for a new organization. There is no difference in this feature between GitHub.com and GitHub Enterprise currently.
Code referenced:
https://github.com/ssmirr/AssignMe/blob/master/assignme.js#L101-L115
I suggest adjusting this PUT
request to include a request body that specifies the asserted permission
setting to be pull
. I would also highly-advise configuring your organization's default member permissions appropriately. Otherwise, you will run into a scenario where students, by default, will have read on every organizational repository. This is obviously not what you probably want.
Additionally, when you create at team, you can specify a default permission level for all added repositories. This may or may not be useful to add to your team provisioning procedure. I would advise doing so.
Lastly, there are several very good and well thought-out GitHub clients for Node.js that you could be using rather than having to maintain your own set of procedures. This would greatly-reduce the amount of code you have to own and increase the reliability of this script through automated tests backing that client. I would highly suggest moving a script like this towards that end as it will reduce the amount of "it works on my machine" scenarios as well.
This (mikedeboer/node-github) seems to be a reasonably popular choice for Node.js and can be installed via npm
. I'd consider checking it out and relying on it to interface our GitHub Enterprise installation.