This commit is contained in:
Yukko 2025-06-01 05:56:56 +00:00 committed by GitHub
commit 48093565ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

18
main.go
View File

@ -5,6 +5,7 @@ import (
"context"
"crypto/sha256"
"encoding/hex"
"fmt"
"io"
"net/http"
"os"
@ -394,7 +395,20 @@ func generate(release *github.RepositoryRelease, output string, cnOutput string,
}
func setActionOutput(name string, content string) {
os.Stdout.WriteString("::set-output name=" + name + "::" + content + "\n")
outputFile := os.Getenv("GITHUB_OUTPUT")
if outputFile == "" {
fmt.Println("GITHUB_OUTPUT not set (not running in GitHub Actions?)")
return
}
f, err := os.OpenFile(outputFile, os.O_APPEND|os.O_WRONLY, 0644)
if err != nil {
panic(err)
}
defer f.Close()
if _, err := fmt.Fprintf(f, "%s=%s\n", name, content); err != nil {
panic(err)
}
fmt.Printf("setActionOutput: %s=%s\n", name, content)
}
func release(source string, destination string, output string, cnOutput string, ruleSetOutput string, ruleSetOutputUnstable string) error {
@ -416,7 +430,7 @@ func release(source string, destination string, output string, cnOutput string,
if err != nil {
return err
}
setActionOutput("tag", *sourceRelease.Name)
setActionOutput("tag", *sourceRelease.TagName)
return nil
}