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 f75b91d304431d8cf315e2ba04acbeca6d97552d
Author: kezhenxu94 <[email protected]>
AuthorDate: Tue May 10 15:05:02 2022 +0800

    Add GitHub Action step summary for better experience
---
 commands/header_check.go | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/commands/header_check.go b/commands/header_check.go
index e0ec2e1..802fde7 100644
--- a/commands/header_check.go
+++ b/commands/header_check.go
@@ -18,6 +18,9 @@
 package commands
 
 import (
+       "fmt"
+       "os"
+
        "github.com/apache/skywalking-eyes/internal/logger"
        "github.com/apache/skywalking-eyes/pkg/header"
        "github.com/apache/skywalking-eyes/pkg/review"
@@ -43,6 +46,14 @@ 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()))
+                       }
+               }
+
                if result.HasFailure() {
                        if err := review.Header(&result, &Config); err != nil {
                                logger.Log.Warnln("Failed to create review 
comments", err)

Reply via email to