Skip to content
This repository was archived by the owner on Aug 26, 2023. It is now read-only.

Commit 098f349

Browse files
authored
Repo support (#38)
* feature(main): add issue_renew action for action repo_support Signed-off-by: cuisongliu <cuisongliu@qq.com> * feature(main): add issue_renew action for action repo_support Signed-off-by: cuisongliu <cuisongliu@qq.com> --------- Signed-off-by: cuisongliu <cuisongliu@qq.com>
1 parent 348acd1 commit 098f349

File tree

6 files changed

+14
-5
lines changed

6 files changed

+14
-5
lines changed

.github/workflows/test-issue-renew.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
SEALOS_ISSUE_BODYFILE: "README.md"
2626
SEALOS_ISSUE_LABEL: "dayly-report"
2727
SEALOS_ISSUE_TYPE: "day"
28+
SEALOS_ISSUE_REPO: "labring/gh-rebot"
2829
GH_TOKEN: "${{ secrets.GH_PAT }}"
2930
- run: |
3031
echo "output is ${{ env.SEALOS_ISSUE_NUMBER }}"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ message:
138138
- `SEALOS_ISREPLY: "true"` # 是否回复,根据当前的comment的内容追加
139139

140140
- [x] issue自动创建
141-
> 该功能v0.0.7-rc3支持
141+
> 该功能v0.0.7支持
142142
143143
入参:
144144

pkg/action/action.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,14 @@ func GetEnvFromAction(key string) (string, error) {
6161
return val, nil
6262
}
6363

64-
func getRepo() (string, string, error) {
64+
func getRepo(r string) (string, string, error) {
65+
if r != "" {
66+
split := strings.Split(r, "/")
67+
if len(split) != 2 {
68+
return "", "", fmt.Errorf("repo format error")
69+
}
70+
return split[0], split[1], nil
71+
}
6572
repo := os.Getenv("GITHUB_REPOSITORY") // 获取环境变量GITHUB_REF
6673
if repo == "" {
6774
return "", "", fmt.Errorf("not found GITHUB_REPOSITORY")

pkg/action/action_comment_reply.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func CommentReply() error {
5252
comment = strings.Join([]string{replyBody, comment}, "\r\n\r\n")
5353
}
5454

55-
owner, repo, err := getRepo()
55+
owner, repo, err := getRepo("")
5656
if err != nil {
5757
return err
5858
}

pkg/action/action_issue_renew.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ func IssueRenew() error {
5858
default:
5959
issueTitle = issueTitle + " " + utils.FormatDay(time.Now())
6060
}
61+
issueRepo, _ := GetEnvFromAction("issue_repo")
6162

62-
owner, repo, err := getRepo()
63+
owner, repo, err := getRepo(issueRepo)
6364
if err != nil {
6465
return err
6566
}

pkg/action/action_pr_comment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func PRComment() error {
4747
if err != nil {
4848
return err
4949
}
50-
owner, repo, err := getRepo()
50+
owner, repo, err := getRepo("")
5151
if err != nil {
5252
return err
5353
}

0 commit comments

Comments
 (0)