Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic detection of default branch doesn't work for private repositories #474

Closed
mattpodraza opened this issue Jun 23, 2020 · 5 comments · Fixed by #490
Closed

Automatic detection of default branch doesn't work for private repositories #474

mattpodraza opened this issue Jun 23, 2020 · 5 comments · Fixed by #490
Assignees
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@mattpodraza
Copy link

mattpodraza commented Jun 23, 2020

Environment details

  • OS: macOS Catalina 10.15.5
  • Node.js version: 12.18.1
  • npm version: 6.14.5
  • release-please version: 5.4.0

Steps to reproduce

Trying from CLI is enough, although the same can be reproduced using a Github action

  1. Try and create a release PR for a private repository, with a token that does have access to it
  2. Automatic detection of the default branch fails with 404 Not found:
✔ found 3 commits since 2cdb083e8574b07991fcc1f6332bb84c8263d71f
✔ release as minor: There are 0 BREAKING CHANGES and 1 features
✖ branch release-v2.3.0 already exists
✔ updating CHANGELOG.md
✔ updating package.json from 2.2.2 to 2.3.0
✔ updating package-lock.json from 2.2.2 to 2.3.0
✖ file samples/package.json did not exist
command release-pr failed with status 404

When I've hooked a debugger into the process I noticed that the GET /repos/:owner/:repo call to Github's API does not have an authorisation header at all, but I didn't spend enough time looking through #468 to figure out why.

There is a simple workaround - specifying the default brach manually allows release-please to continue.

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Jun 24, 2020
@bcoe bcoe added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Jun 29, 2020
@bcoe
Copy link
Contributor

bcoe commented Jun 29, 2020

@mateuszpodraza thank you for the bug report 👍 I could have sworn the client was authenticated during instantiation (I will need to dig into this).

@yoshi-automation yoshi-automation removed triage me I really want to be triaged. 🚨 This issue needs some love. labels Jun 29, 2020
@lancedikson
Copy link
Contributor

lancedikson commented Jul 17, 2020

I ran into the same issue today. The same problem is failing our release-please gh action on private repos, and there's no such a way to use a workaround by specifying the default branch manually as there's no such input param in the action configuration. So, I dug deeper a bit and it seems that octokit expects headers in the repos.get method as well.

lancedikson added a commit to lancedikson/release-please that referenced this issue Jul 17, 2020
Octokit seem to expect headers to be passed along
with the repo and owner params.
fixes googleapis#474
@lancedikson
Copy link
Contributor

This bug is the only obstacle we have on the way of using release-please action in our team processes, so @bcoe I would appreciate if you could take a look at this PR soonish 🙏

@lancedikson
Copy link
Contributor

lancedikson commented Jul 22, 2020

While the fix is not released I came up with a fork that heals the bug — may be useful for somebody else who encountered the issue. One can use this action as for now:

jobs:
  release-please:
    runs-on: ubuntu-latest
    steps:
      - uses: lancedikson/release-please-action@tmp-patch-release-please-version

@bcoe bcoe closed this as completed in #490 Jul 23, 2020
bcoe added a commit that referenced this issue Jul 23, 2020
Octokit seem to expect headers to be passed along
with the repo and owner params.
fixes #474

Co-authored-by: Benjamin E. Coe <bencoe@google.com>
@jef
Copy link

jef commented Aug 20, 2020

Thanks @bcoe !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants