Skip to content

Commit

Permalink
Merge pull request #47 from openziti/update-ref-and-fix-bad-issue
Browse files Browse the repository at this point in the history
Update ref to openziti in action.yml and don't fail on issues that can't be found
  • Loading branch information
plorenz authored Nov 22, 2024
2 parents 403e0e0 + 83940dd commit 9f6c609
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ runs:
steps:
- name: install ziti-ci
shell: bash
run: go install github.com/netfoundry/ziti-ci@${{ inputs.ziti-ci-version }}
run: go install github.com/openziti/ziti-ci@${{ inputs.ziti-ci-version }}
6 changes: 4 additions & 2 deletions cmd/build_release_notes.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,9 +306,11 @@ func (cmd *baseBuildReleaseNotesCmd) outputIssue(issue string) {
if err != nil {
panic(errors.Wrap(err, "gh (github CLI) not found. Please make sure it's installed an you are authenticated"))
}
out := cmd.runCommandWithOutput("Get Issue", bin,
out, err := cmd.runCommandWithOutputFailOptional(false, "Get Issue", bin,
"issue", "view", issue, "--json", "number,title,url", "--jq", `"[Issue #" + (.number|tostring) + "](" + .url + ") - " + .title`)
fmt.Printf(" * %v\n", out[0])
if err == nil {
fmt.Printf(" * %v\n", out[0])
}
}

func newBuildReleaseNotesCmd(root *RootCommand) *cobra.Command {
Expand Down
13 changes: 11 additions & 2 deletions cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,13 +251,22 @@ func (cmd *BaseCommand) getGoEnv() map[string]string {
}

func (cmd *BaseCommand) runCommandWithOutput(description string, name string, params ...string) []string {
result, _ := cmd.runCommandWithOutputFailOptional(true, description, name, params...)
return result
}

func (cmd *BaseCommand) runCommandWithOutputFailOptional(fail bool, description string, name string, params ...string) ([]string, error) {
cmd.Infof("%v: %v %v\n", description, name, strings.Join(params, " "))
command := exec.Command(name, params...)
command.Stderr = nil
output := &bytes.Buffer{}
command.Stdout = output
if err := command.Run(); err != nil {
cmd.Failf("error %v: %v\n", description, err)
if fail {
cmd.Failf("error %v: %v\n", description, err)
} else {
return nil, err
}
}

stringData := strings.Replace(output.String(), "\r\n", "\n", -1)
Expand All @@ -268,7 +277,7 @@ func (cmd *BaseCommand) runCommandWithOutput(description string, name string, pa
result = append(result, line)
}
}
return result
return result, nil
}

func (cmd *BaseCommand) runCommand(description string, name string, params ...string) {
Expand Down

0 comments on commit 9f6c609

Please sign in to comment.