@@ -187,17 +187,16 @@ func cloneAndAddRepositoryToIssue(config IssuectlConfig, profile *Profile, issue
187187// OpenPullRequest opens pull request
188188func OpenPullRequest (issueID IssueID ) error {
189189 config := LoadConfig ()
190- profile := config .GetProfile (config .GetCurrentProfile ())
190+ issue , found := config .GetIssue (issueID )
191+ if ! found {
192+ return errors .New ("Issue not found" )
193+ }
194+ profile := config .GetProfile (issue .Profile )
191195
192196 if profile .RepoBackend == "" {
193197 return errors .New ("Repository Backend not defined" )
194198 }
195199
196- issue , found := config .GetIssue (issueID )
197- if ! found {
198- return fmt .Errorf (errIssueIDNotFound )
199- }
200-
201200 repoBackend , err := getRepoBackendConfigurator (config .GetBackend (profile .RepoBackend ))
202201 if err != nil {
203202 return err
@@ -237,7 +236,12 @@ func OpenPullRequest(issueID IssueID) error {
237236// FinishWorkingOnIssue finishes work on an issue
238237func FinishWorkingOnIssue (issueID IssueID ) error {
239238 config := LoadConfig ().GetPersistent ()
240- profile := config .GetProfile (config .GetCurrentProfile ())
239+ issue , found := config .GetIssue (issueID )
240+ if ! found {
241+ return errors .New ("Issue not found" )
242+ }
243+ profile := config .GetProfile (issue .Profile )
244+
241245 repo := config .GetRepository (profile .DefaultRepository )
242246
243247 Log .Infof (" 🥂\t Finishing work on %v" , issueID )
@@ -260,11 +264,6 @@ func FinishWorkingOnIssue(issueID IssueID) error {
260264
261265 }
262266
263- issue , found := config .GetIssue (issueID )
264- if ! found {
265- return errors .New (errIssueIDNotFound )
266- }
267-
268267 Log .Infof (" 🧹\t Cleaning up issue workdir" )
269268
270269 if err := os .RemoveAll (issue .Dir ); err != nil {
0 commit comments