Skip to content

Commit

Permalink
add pipeline for release
Browse files Browse the repository at this point in the history
  • Loading branch information
cuisongliu committed Apr 18, 2023
1 parent 0b39ba5 commit 1eda673
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/gh-bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ changelog:
- cuisongliu

release:
retry: 15s
action: Release
allowOps:
- cuisongliu
Expand Down
3 changes: 2 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ type Changelog struct {
}

type Release struct {
Action string
Retry string `json:"retry"`
Action string `json:"action"`
AllowOps []string `json:"allowOps"`
}

Expand Down
8 changes: 7 additions & 1 deletion pkg/gh/check_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/labring-actions/gh-rebot/pkg/utils"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/util/json"
"time"
)

type ActionOut struct {
Expand Down Expand Up @@ -51,7 +52,12 @@ func CheckRelease(tagName string) (*ActionOut, error) {
return &out, nil
}
if out.Conclusion == "" {
logger.Debug("workflow release is in progress, please wait")
tt, err := time.ParseDuration(config.GlobalsConfig.Release.Retry)
if err != nil {
tt = time.Second * 20
}
logger.Debug("workflow release is in progress, please wait %s retry", tt.String())
time.Sleep(tt)
return CheckRelease(tagName)
}
return nil, errors.New("workflow Conclusion is error")
Expand Down

0 comments on commit 1eda673

Please sign in to comment.