Danger: Bitrise repository URL not parsed when repo is public

Created on 12 Nov 2018  路  4Comments  路  Source: danger/danger

Report

What did you do?

When running Danger from a public Bitrise app: the following results in an error when parsing the repository URL.

bundle install
bundle exec danger

It seems the value of GIT_REPOSITORY_URL environment variable is different when using a public Bitrise app vs a private one. Public apps make use of the https:// git URL format, whereas the private ones use git@ format.

What did you expect to happen?

Running your Dangerfile without it crashing.

What happened instead?

There was an error when parsing the repository URL

Octokit::InvalidRepository: "github.com/duckduckgo/Android" is invalid as a repository identifier. 
Use the repo/user (String) format, or the repository ID (Integer), or a hash containing :repo and :user keys.

Your Environment

  • Which CI are you running on? BitRise
  • Are you running the latest version of Danger? Yes (5.8.0)
  • What is your Dangerfile?

```
# Sometimes it's a README fix, or something like that - which isn't relevant for
# including in a project's CHANGELOG for example
declared_trivial = github.pr_title.include? "#trivial"

# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"

# Warn when there is a big PR
warn("Big PR") if git.lines_of_code > 500```

Most helpful comment

I created an internal tracker card for this, hope we can allocate some engineering hours to fix it 馃槈

All 4 comments

In case anyone else hits this, as a workaround, I manually exported the GIT_REPOSITORY_URL before invoking Danger

export GIT_REPOSITORY_URL="[email protected]/duckduckgo/android.git"
bundle install
bundle exec danger

And this let me get it building again.

One more info/detail, the related code seems to be https://github.com/danger/danger/blob/master/lib/danger/ci_source/bitrise.rb#L40 -> this regex will only work for the [email protected]:... style git clone URL (GIT_REPOSITORY_URL), and not for the https://github.com/... one.

Sounds good, there must be other regexes in danger that can be used for a reference and update

I created an internal tracker card for this, hope we can allocate some engineering hours to fix it 馃槈

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dzenbot picture dzenbot  路  7Comments

bruno-rocha-movile picture bruno-rocha-movile  路  7Comments

nikolaykasyanov picture nikolaykasyanov  路  8Comments

orta picture orta  路  9Comments

tbrand picture tbrand  路  6Comments