danger / danger/danger-js

Unable to set the correct repository name

Open
#526 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
5.5k
Forks
381
Avg merge
2h 8m
Merged PRs (30d)
6

Description

Hey there, my organization is trying integrate Danger.js into our workflow but we've run into an issue when using forked repos.

We have the following setup:

```
user1/repo
org/repo
```

If `user1` opens a pull request against `org/repo`, Danger.js seems to construct the wrong `repoSlug` when running `danger.git.diffForFile()`. For example, if the PR URL is `https://github.com/org/repo/pull/1`, Danger.js will hit a 404 by trying to request `https://github.com/user1/repo/pull/1`.

This seems to be caused by this line: https://github.com/danger/danger-js/blob/master/source/platforms/github/GitHubGit.ts#L45

For my organization, we need `github.pr.head.repo.full_name` to be `github.pr.base.repo.full_name`.

Is there a way we can specify the repo that we're missing, or is this workflow outside of the current functionality of Danger.js?

Contributor guide

Open the contributing guide

Research direction

Start at source/platforms/github/GitHubGit.ts line 45 and inspect how repoSlug is derived for forked pull requests. Reproduce the org/repo scenario from the issue and verify that diffForFile requests the base repository while normal pull requests continue to work; check for relevant existing coverage before changing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
github, typescript
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.