Skip to content

Commit

Permalink
Merge pull request juju#15996 from barrettj12/merge-3.1-3.2-20230725
Browse files Browse the repository at this point in the history
juju#15996

Merges the following patches:
- juju#15989
- juju#15951

### Conflicts
None.
  • Loading branch information
jujubot authored Jul 25, 2023
2 parents 75a9526 + 49449e7 commit 53807f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ jobs:
curl https://github.com/mattermost/mmctl/releases/download/v7.8.5/linux_amd64.tar -Lo mmctl.tar
tar -xvf mmctl.tar
./mmctl auth login 'https://chat.charmhub.io' --name Charmhub --access-token $MM_TOKEN
./mmctl post create Charmhub:juju-watercooler --message "$MESSAGE"
./mmctl post create Charmhub:juju-bot --message "$MESSAGE"
15 changes: 10 additions & 5 deletions scripts/try-merge/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ type commitInfo struct {
}

type prInfo struct {
Number int `json:"number"`
Number int `json:"number"`
State string `json:"state"`
}

// Check if there is already an open merge containing this commit. If so,
Expand All @@ -178,18 +179,22 @@ func commitHasOpenPR(commit commitInfo) (prNumber int, ok bool) {
command: "gh",
args: []string{"pr", "list",
"--search", commit.SHA,
"--state", "open",
"--state", "all",
"--base", targetBranch,
"--json", "number",
"--json", "number,state",
},
})
handleExecuteError(ghRes)

prList := []prInfo{}
check(json.Unmarshal(ghRes.stdout, &prList))

if len(prList) > 0 {
return prList[0].Number, true
for _, pr := range prList {
// Check for merged PRs, just in case the merge PR landed while we've been
// checking for conflicts.
if pr.State == "OPEN" || pr.State == "MERGED" {
return pr.Number, true
}
}
return -1, false
}
Expand Down

0 comments on commit 53807f4

Please sign in to comment.