mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
ci: prevent panic in retest action on nil
strings
In case a PullRequest does not have a MergeableState set, it will be `nil`. Dereferencing the pointer will cause a Go panic, and the action won't work as intended. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
bf9e14d2c9
commit
34ff13984a
@ -116,7 +116,7 @@ func main() {
|
|||||||
log.Fatalf("failed to list pull requests %v\n", err)
|
log.Fatalf("failed to list pull requests %v\n", err)
|
||||||
}
|
}
|
||||||
for _, re := range req {
|
for _, re := range req {
|
||||||
if *re.State == "open" {
|
if (re.State != nil) && (*re.State == "open") {
|
||||||
prNumber := re.GetNumber()
|
prNumber := re.GetNumber()
|
||||||
log.Printf("PR with ID %d with Title %q is open\n", prNumber, re.GetTitle())
|
log.Printf("PR with ID %d with Title %q is open\n", prNumber, re.GetTitle())
|
||||||
for _, l := range re.Labels {
|
for _, l := range re.Labels {
|
||||||
@ -149,7 +149,7 @@ func main() {
|
|||||||
log.Printf("found failed test %s\n", r.GetContext())
|
log.Printf("found failed test %s\n", r.GetContext())
|
||||||
failedTestFound = true
|
failedTestFound = true
|
||||||
// rebase the pr if it is behind the devel branch.
|
// rebase the pr if it is behind the devel branch.
|
||||||
if *re.MergeableState == "BEHIND" {
|
if (re.MergeableState != nil) && (*re.MergeableState == "BEHIND") {
|
||||||
comment := &github.IssueComment{
|
comment := &github.IssueComment{
|
||||||
Body: github.String("@mergifyio rebase"),
|
Body: github.String("@mergifyio rebase"),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user