phly / keep-a-changelog

Tools for manipulating CHANGELOG.md files in Keep A Changelog format, including tagging and releasing.
https://phly.github.io/keep-a-changelog/
BSD 2-Clause "Simplified" License
182 stars 23 forks source link

Selecting remote issue (v1/v2) #58

Closed michalbundyra closed 5 years ago

michalbundyra commented 5 years ago

Bug Report

Q A
BC Break no
Version 2.1.0

Summary

Remotes are not detected and choosing abort try to push "to abort". My remotes are correct:

origin  git://github.com/zendframework/zend-expressive-authentication-oauth2.git (fetch)
origin  git://github.com/zendframework/zend-expressive-authentication-oauth2.git (push)
webimpress  git@github.com:webimpress/zend-expressive-authentication-oauth2.git (fetch)
webimpress  git@github.com:webimpress/zend-expressive-authentication-oauth2.git (push)
zendframework   git@github.com:zendframework/zend-expressive-authentication-oauth2.git (fetch)
zendframework   git@github.com:zendframework/zend-expressive-authentication-oauth2.git (push)

On v1 I've seen option origin and zendframework, but selecting doesn't work as I was getting error "pushing to 0" or "pushing to 1" (so the option number was used instead of the value).

In v2 there is the same issue, but also remotes are not recognised.

Current behaviour

Using version 2.1:

$ keep-a-changelog version:release 1.2.0
More than one valid remote was found; which one should I use?
  [abort] Abort release
 > abort
Pushing tag 1.2.0 to abort
fatal: 'abort' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Error pushing tag to remote!
Please check the output for details.

Using the latest v1 (remotes are detected correctly):

$ keep-a-changelog release zendframework/zend-expressive-authentication-oauth2 1.2.0 --global
Preparing changelog for release
More than one valid remote was found; which one should I use?
  [0    ] origin
  [1    ] zendframework
  [abort] Abort release
 > abort
Pushing tag 1.2.0 to abort
fatal: 'abort' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Error pushing tag to remote!
Please check the output for details.

and:

$ keep-a-changelog release zendframework/zend-expressive-authentication-oauth2 1.2.0 --global
Preparing changelog for release
More than one valid remote was found; which one should I use?
  [0    ] origin
  [1    ] zendframework
  [abort] Abort release
 > 1
Pushing tag 1.2.0 to 1
fatal: '1' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Error pushing tag to remote!
Please check the output for details.

How to reproduce

My configuration (v2):

[defaults]
changelog_file = CHANGELOG.md
provider = github

[providers]
github[class] = Phly\KeepAChangelog\Provider\GitHub
github[token] = Yes
gitlab[class] = Phly\KeepAChangelog\Provider\GitLab
gitlab[token] = Yes

Expected behaviour

geerteltink commented 5 years ago

I ran into this issue today. A work around until fixed is to add the remote argument:

--remote=zendframework
weierophinney commented 5 years ago

I figured out what's happening.

A ChoiceQuestion returns the index of the choice, not the value. As such, I was using the wrong value for the remote when chosen by prompt.

Pushing a PR momentarily.