Skip to content

ghstack land doesn't work on private non-pro repositories #249

@Artamus

Description

@Artamus

Hi ghstack team,

During my playing around with ghstack in a private repository I found that ghstack land won't work on private repositories that don't have GitHub Pro.

This is the error message I'm receiving when trying to land a PR:

ghstack land https://github.com/Artamus/stacked-diff-test/pull/10
ERROR: Fatal exception
Traceback (most recent call last):
  File "/home/artamus/.local/lib/python3.10/site-packages/ghstack/github_real.py", line 198, in rest
    resp.raise_for_status()
  File "/home/artamus/.local/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.github.com/repos/Artamus/stacked-diff-test/branches/main/protection

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/artamus/.local/lib/python3.10/site-packages/ghstack/logs.py", line 105, in manager
    yield
  File "/home/artamus/.local/lib/python3.10/site-packages/ghstack/cli.py", line 46, in cli_context
    yield shell, config, github
  File "/home/artamus/.local/lib/python3.10/site-packages/ghstack/cli.py", line 135, in land
    ghstack.land.main(
  File "/home/artamus/.local/lib/python3.10/site-packages/ghstack/land.py", line 72, in main
    protection = github.get(
  File "/home/artamus/.local/lib/python3.10/site-packages/ghstack/github.py", line 67, in get
    return self.rest("get", path, **kwargs)
  File "/home/artamus/.local/lib/python3.10/site-packages/ghstack/github_real.py", line 200, in rest
    raise RuntimeError(pretty_json)
RuntimeError: {
 "message": "Upgrade to GitHub Pro or make this repository public to enable this feature.",
 "documentation_url": "https://docs.github.com/rest/branches/branch-protection#get-branch-protection"
}

To reproduce, simply create a private repository and try to create a stack of 2 commits and land them with ghstack.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions