From 8db94a0c48fdc84f9bacbbeaa9b279afe76a55dc Mon Sep 17 00:00:00 2001 From: Rick <1450685+LinuxSuRen@users.noreply.github.com> Date: Fri, 20 Dec 2024 20:25:19 +0800 Subject: [PATCH 1/2] Add emoji into the PR status template Fixes #56 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/LinuxSuRen/gogit/issues/56?shareId=XXXX-XXXX-XXXX-XXXX). --- cmd/argoworkflow/template/comment.go | 2 +- cmd/argoworkflow/template/comment_test.go | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cmd/argoworkflow/template/comment.go b/cmd/argoworkflow/template/comment.go index 9126141..43f9afe 100644 --- a/cmd/argoworkflow/template/comment.go +++ b/cmd/argoworkflow/template/comment.go @@ -8,7 +8,7 @@ const CommentTemplate = ` | Stage | Status | Duration | |---|---|---| {{- range $_, $status := .Status.Nodes}} -| {{$status.DisplayName}} | {{$status.Phase}} | {{duration $status.FinishedAt $status.StartedAt}} | +| {{$status.DisplayName}} | {{if eq $status.Phase "Failed"}}:broken_heart:{{else if eq $status.Phase "Succeeded"}}:white_check_mark:{{else if eq $status.Phase "Running"}}:hourglass_flowing_sand:{{end}} {{$status.Phase}} | {{duration $status.FinishedAt $status.StartedAt}} | {{- end}} ` diff --git a/cmd/argoworkflow/template/comment_test.go b/cmd/argoworkflow/template/comment_test.go index 9e922e6..9f8663e 100644 --- a/cmd/argoworkflow/template/comment_test.go +++ b/cmd/argoworkflow/template/comment_test.go @@ -18,17 +18,14 @@ func TestCommentTemplate(t *testing.T) { startTime := v1.Time{Time: targetTime} endTime := v1.Time{Time: startTime.Add(time.Second * 5)} - node1 := map[string]interface{}{"Phase": "Success", "DisplayName": "node-1", "StartedAt": startTime, "FinishedAt": endTime, "StartedTime": "2023-01-06T07:49:07Z", "EndedTime": "2023-01-06T07:54:26Z"} + node1 := map[string]interface{}{"Phase": "Succeeded", "DisplayName": "node-1", "StartedAt": startTime, "FinishedAt": endTime, "StartedTime": "2023-01-06T07:49:07Z", "EndedTime": "2023-01-06T07:54:26Z"} node2 := map[string]interface{}{"Phase": "Failed", "DisplayName": "node-2", "StartedAt": startTime, "FinishedAt": endTime, "StartedTime": "2023-01-06T07:49:07Z", "EndedTime": "2023-01-06T07:54:26Z"} - // TODO cannot handle the situation in template - // node3 := map[string]interface{}{"DisplayName": "node-2.OnExit"} - // node4 := map[string]interface{}{"DisplayName": "plugin-8bs4n.hooks.all"} + node3 := map[string]interface{}{"Phase": "Running", "DisplayName": "node-3", "StartedAt": startTime, "FinishedAt": endTime, "StartedTime": "2023-01-06T07:49:07Z", "EndedTime": "2023-01-06T07:54:26Z"} nodes := map[string]interface{}{} nodes["node1"] = node1 nodes["node2"] = node2 - // nodes["node3"] = node3 - // nodes["node4"] = node4 + nodes["node3"] = node3 status := map[string]interface{}{} status["Nodes"] = nodes @@ -56,8 +53,9 @@ func TestCommentTemplate(t *testing.T) { | Stage | Status | Duration | |---|---|---| -| node-1 | Success | 5s | -| node-2 | Failed | 5s | +| node-1 | :white_check_mark: Succeeded | 5s | +| node-2 | :broken_heart: Failed | 5s | +| node-3 | :hourglass_flowing_sand: Running | 5s | `, result) result, err = template.RenderTemplate(` @@ -73,8 +71,9 @@ func TestCommentTemplate(t *testing.T) { | Stage | Status | Duration | |---|---|---| -| node-1 | Success | 5m19s | +| node-1 | Succeeded | 5m19s | | node-2 | Failed | 5m19s | +| node-3 | Running | 5m19s | `, result) } From 7d3fd75d88a541a84654e87d8da37b3bbd530123 Mon Sep 17 00:00:00 2001 From: zhaoxiaojie Date: Mon, 23 Dec 2024 09:53:07 +0800 Subject: [PATCH 2/2] update goreleaser arguments --- .github/dependabot.yml | 11 +++++++++++ .github/workflows/pull-request.yaml | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..cd88554 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "gomod" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "weekly" diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index 163098b..871e3e8 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -68,10 +68,10 @@ jobs: - name: Check out code uses: actions/checkout@v3.0.0 - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2.9.1 + uses: goreleaser/goreleaser-action@v6 with: - version: latest - args: release --skip-publish --rm-dist + version: '~> v2' + args: release --clean --snapshot build-image: name: Build Image