googleapis / googleapis/release-please
Forks don't have access to associated PR nodes
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 588
- Avg merge
- 12h 16m
- Merged PRs (30d)
- 7
Description
Forks in separate org/user are unable to access associated PRs which results in:
```
TypeError: Cannot read properties of null (reading 'mergeCommit')
at build/src/github.js:589:27
at Array.find ()
at GitHub.mergeCommitsGraphQL (build/src/github.js:588:74)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async GitHub.mergeCommitIterator (build/src/github.js:495:30)
at async Context. (build/test/github.js:432:30)
```
This seems to be due to the PR info being on account `acmeOrg/myRepo` while the fork is in `myUsername/myRepo` and does not have access to info from the original. Probably due to the fine grain access token only having access to `myUsername` and not both; `myUsername` and `acmeOrg`.
#### Environment details
- OS: MacOS
- Node.js version: v18.17.1
- npm version: 9.6.7
- `release-please` version: v3
#### Steps to reproduce
1. Fork a project that has been using release-please for a while **under a different org/user** (important). Make sure that a few PRs were generated and landed.
2. Setup fork to run release-please just like the original. Since Fined grained tokens can only be used on a single org/user, you need to create a new one.
3. In the forked repo create pr, merge. You will get the following error: `TypeError: Cannot read properties of null (reading 'mergeCommit')` coming from [this](https://github.com/googleapis/release-please/blob/main/src/github.ts#L479) line. This is probably because the token does not have access to both org's/user's repos.
The YAML config in the fork I have is:
```yaml
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: node
command: release-pr
token: ${{ secrets.FORK_ACTION_SECRET }}
```
I have a [fix](https://github.com/sam3k/release-please/commit/bffc916d2b85c4ed6f4dc01636f27d29c8e33196) to at least suppress the error; but it does not fix the issue for forks. I'd be happy to submit this small fix I have to suppress the error.
Contributor guide
Assessment
This issue has not been assessed yet.