microsoft / microsoft/pxt-microbit

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

Open
#5,761 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cli engineering extension P2
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the testghpkgs pxt command and the linked CI job, then trace how an extension without tags selects a GitHub branch. Reproduce the lookup for yfrobot-tm/pxt-yfrobot-valon and compare the master and main URLs shown in the issue. Done means tagless extensions using main when master is unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, typescript
Domain
api, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.