Skip to content

Commit

Permalink
fix: Do not add invalid milestone to closed issues (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcer authored Oct 25, 2024
1 parent cfefbd3 commit 301bf8a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nu/milestone.nu
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export def 'milestone-bind-for-issue' [
return
}
let token = $env.GH_TOKEN? | default $env.GITHUB_TOKEN?
let selected = if ($milestone | is-empty) { query-issue-closer-by-graphql $repo $issue $token | get closedBy?.milestone? } else { $milestone }
let selected = if ($milestone | is-empty) { query-issue-closer-by-graphql $repo $issue $token | get closedBy?.milestone? | default '-' } else { $milestone }
if $force {
let prevMilestone = gh issue view $issue --repo $repo --json 'milestone' | from json | get milestone?.title? | default '-'
let shouldRemove = $prevMilestone != $selected
Expand All @@ -88,6 +88,10 @@ export def 'milestone-bind-for-issue' [
print $'(char nl)Milestone for Issue (ansi p)($issue)(ansi reset) in repo (ansi p)($repo)(ansi reset) was already set to (ansi p)($prevMilestone)(ansi reset), will be ignored.'
}
}
if $selected == '-' {
print $'No milestone found for issue (ansi p)($issue)(ansi reset) in repository (ansi p)($repo)(ansi reset).'
return
}
print $'(char nl)Setting milestone to (ansi p)($selected)(ansi reset) for Issue (ansi p)($issue)(ansi reset) in repository (ansi p)($repo)(ansi reset) ...'
# FIXME: GraphQL: Resource not accessible by integration (updatePullRequest)
if not $dry_run {
Expand Down

0 comments on commit 301bf8a

Please sign in to comment.