This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch gha-summary
in repository https://gitbox.apache.org/repos/asf/skywalking-eyes.git

commit a4b029191caed446d292d259c2a432435d5f655a
Author: kezhenxu94 <[email protected]>
AuthorDate: Tue May 10 15:16:22 2022 +0800

    Test
---
 .github/workflows/license-eye-check.yaml |  1 +
 commands/header_check.go                 | 21 ++++++++++++++-------
 test.go                                  |  1 +
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/license-eye-check.yaml 
b/.github/workflows/license-eye-check.yaml
index d650d5b..fbb26c9 100644
--- a/.github/workflows/license-eye-check.yaml
+++ b/.github/workflows/license-eye-check.yaml
@@ -22,6 +22,7 @@ on:
   push:
     branches:
       - main
+      - gha-summary
 
 jobs:
   build-license-eye:
diff --git a/commands/header_check.go b/commands/header_check.go
index 802fde7..119b67a 100644
--- a/commands/header_check.go
+++ b/commands/header_check.go
@@ -46,13 +46,7 @@ var CheckCommand = &cobra.Command{
 
                logger.Log.Infoln(result.String())
 
-               if summaryFileName := os.Getenv("GITHUB_STEP_SUMMARY"); 
summaryFileName != "" {
-                       if summaryFile, err := os.OpenFile(summaryFileName, 
os.O_WRONLY|os.O_APPEND, 0o644); err == nil {
-                               defer summaryFile.Close()
-                               _, _ = summaryFile.WriteString(result.String())
-                               _, _ = 
summaryFile.WriteString(fmt.Sprintln(result.Error()))
-                       }
-               }
+               writeSummaryQuietly(&result)
 
                if result.HasFailure() {
                        if err := review.Header(&result, &Config); err != nil {
@@ -64,3 +58,16 @@ var CheckCommand = &cobra.Command{
                return nil
        },
 }
+
+func writeSummaryQuietly(result *header.Result) {
+       if summaryFileName := os.Getenv("GITHUB_STEP_SUMMARY"); summaryFileName 
!= "" {
+               if summaryFile, err := os.OpenFile(summaryFileName, 
os.O_WRONLY|os.O_APPEND, 0o644); err == nil {
+                       defer summaryFile.Close()
+                       _, _ = summaryFile.WriteString(result.String())
+                       if result.HasFailure() {
+                               _, _ = summaryFile.WriteString("\n\n<br>")
+                               _, _ = 
summaryFile.WriteString(fmt.Sprintln(result.Error()))
+                       }
+               }
+       }
+}
diff --git a/test.go b/test.go
new file mode 100644
index 0000000..06ab7d0
--- /dev/null
+++ b/test.go
@@ -0,0 +1 @@
+package main

Reply via email to