microsoft / pxt-microbit

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

When an extension doesn't have tags it tries to retrieve the `master` branch and doesn't try the `main` branch #5761

Open microbit-carlos opened 4 months ago

microbit-carlos commented 4 months ago

Found via CI running the testghpkgs pxt command: https://github.com/microsoft/pxt-microbit/actions/runs/10153131737/job/28075895576

For the extension https://github.com/yfrobot-tm/pxt-yfrobot-valon :

yfrobot-tm/pxt-yfrobot-valon
warning: https://github.com/yfrobot-tm/pxt-yfrobot-valon create a release
github proxy error: Bad HTTP status code: 404 at https://makecode.com/api/gh/yfrobot-tm/pxt-yfrobot-valon/master/text; message: {"message":"ref response: 404"}
error: https://github.com/yfrobot-tm/pxt-yfrobot-valon build error

The additional logs show:

Bad HTTP status code: 404 at https://api.github.com/repos/yfrobot-tm/pxt-yfrobot-valon/git/refs/heads/master?rnd=0.6099283187397602; message: {"message":"Not Found","documentation_url":"https://docs.github.com/rest/git/refs#get-all-references-in-a-namespace","status":"404"}

So my understanding is that the https://api.github.com/repos/yfrobot-tm/pxt-yfrobot-valon/git/refs/heads/master?rnd=0.6099283187397602 and https://makecode.com/api/gh/yfrobot-tm/pxt-yfrobot-valon/master/text URLs don't work because it's looking for a master branch, and the repo has a main branch instead.

Changing that to https://api.github.com/repos/yfrobot-tm/pxt-yfrobot-valon/git/refs/heads/main?rnd=0.6099283187397602 and https://makecode.com/api/gh/yfrobot-tm/pxt-yfrobot-valon/main/text, and those do work.

❌ https://api.github.com/repos/yfrobot-tm/pxt-yfrobot-valon/git/refs/heads/master?rnd=0.6099283187397602
✅ https://api.github.com/repos/yfrobot-tm/pxt-yfrobot-valon/git/refs/heads/main?rnd=0.6099283187397602
❌ https://makecode.com/api/gh/yfrobot-tm/pxt-yfrobot-valon/master/text
✅ https://makecode.com/api/gh/yfrobot-tm/pxt-yfrobot-valon/main/text
microbit-carlos commented 4 months ago

Same issue with extension sgbotic/pxt-sgbotic-ultimate-sr04-rgb :

warning: https://github.com/sgbotic/pxt-sgbotic-ultimate-sr04-rgb create a release
github proxy error: Bad HTTP status code: 404 at https://makecode.com/api/gh/sgbotic/pxt-sgbotic-ultimate-sr04-rgb/master/text; message: {"message":"ref response: 404"}
error: https://github.com/sgbotic/pxt-sgbotic-ultimate-sr04-rgb build error