microsoft / pxt-microbit

A Blocks / JavaScript code editor for the micro:bit built on Microsoft MakeCode
https://makecode.microbit.org
Other
722 stars 594 forks source link

MakeCode and GitHub Classroom - permissions issue #5290

Closed Mr-Coxall closed 1 year ago

Mr-Coxall commented 1 year ago

I want to use Micro:bits with my students. It is a grade 10 class, so I do not want to use block language but JavaScript for the beginning students. For more advance students I want them to use MicroPython in CodeSpace IDE. They all use GitHub Classroom to get their repo.

For all students I have created a template Repo that I can push to them using GitHub Classroom. (https://github.com/TEJ2O-Templates/TEJ2O-Template)

It loads uFlash (https://pypi.org/project/uflash/) in Codespace. They then use py2hex, it creates the *.hex file, they download it locally (to their Chromebook) drag the file over and it flashes. They can push their changes back to the repo as normal. Everything works great. They get to use python, Codespace and a modern IDE.

For the students that are starting out, I have added the Micro:bit MakeCode files into the same repo. (1 repo for all students and if they finish the JavaScript way, they can transistion over to using Codespace) They go to MakeCode Micro:bit and use the "add URL" command. Update their code and flash it. All works great.

The problem is that MakeCode Micro:bit will not let the students "push" changes to their code back to the GitHub repo that GitHub Classroom gave them. If they fork the repo and become the owner it works, but I do not want them doing that. The problem seems to be since my Org is the owner of the repo, even though they have permission to change it, MakeCode Micro:bit will not let them.

jwunderl commented 1 year ago

can you check on https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-membership-in-organizations/requesting-organization-approval-for-oauth-apps and see how that works? It's not optimal / I'll have to poke around to see if there's any way we can make this easier from our side / include requesting org access in the original request (I guess sneak in a link to the page? I don't see an api we can hit right away / it looks like it requires approval on the org owner side)

Mr-Coxall commented 1 year ago

I gave that it a try and it worked. The only prolem is that it would be an administrative nightmare to have to click several times for each student for each repo to add the permission.

I looked into GitHub CLI but can not see a way to automate the process. Thoughts?

Thanks, Patrick

Mr-Coxall commented 1 year ago

OK, correction.

You only have to add in a GitHub account once and then it will contimue to work. Thanks so much, this totally solves my issues.

jwunderl commented 1 year ago

Thanks for confirming, yes it should just be once per user per org to grant those permissions; I'll keep an eye out for if there's any good ways to smooth out this experience but glad it worked out for your use case!