FirebaseExtended / FirebaseExtended/action-hosting-deploy

firebase init hosting:github, 404 error if the repo belongs to an organization

Open
#40 21 comments 53 reactions 0 assignees View on GitHub
ongoing
Dominant language
TypeScript
Stars
809
Forks
232
PR merge metrics
No merged PRs in 30d

Description

First off, I'm brand new to firebase hosting and github actions, so it's entirely possible that I'm approaching this the wrong way, but I haven't found any mention of this being incorrect in the docs.

### To reproduce

1. Create an organization on Github.
2. Upload your repo to your org and set it as the remote origin
3. Locally, use the command `firebase init hosting:github`

I authenticate successfully, then I'm prompted to enter the name of the repo, and it even suggests the correct repo in the format `my-org-name/my-repo-name`. So, I enter that but get the error `FirebaseError: HTTP Error: 404, Not Found`

### Analysis
Looking at the firebase-debug.log, it looks like the cli makes the assumption that the repo belongs to a user, which isn't correct in this case i.e. from what I entered, it's forming the request:
`HTTP REQUEST GET https://api.github.com/repos/my-org-name/my-repo-name/actions/secrets/public-key?type=owner `
but the [API](https://docs.github.com/en/free-pro-team@latest/rest/reference/actions#get-a-repository-public-key) is expecting:
`...api.github.com/repos/my-github-username/my-repo-name/...`

However, if I enter `my-github-username/my-repo-name` at the prompt, I get the same error but that's because the repo doesn't exist under my account, it belongs to the org.

Maybe it's a limitation of Github's API? Or maybe your intention is that developers always fork the repo, so this is more of a documentation issue (or lack of knowledge on my behalf)?

To work around this, I'm going to transfer the repo to my account, but I thought I'd mention it here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.