-
Notifications
You must be signed in to change notification settings - Fork 2
/
actions.go
62 lines (49 loc) · 1.24 KB
/
actions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package github_actions
import (
"fmt"
"log"
"os"
)
func SetOutput(name, value string) {
if err := setOutput(name, value); err != nil {
SetError("Failed to set outputs.%s\n", name)
}
}
func setOutput(name, value string) error {
Debug("setting output %s=%s", name, value)
output := os.Getenv("GITHUB_OUTPUT")
f, err := os.OpenFile(output, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return err
}
defer f.Close()
_, err = fmt.Fprintf(f, "%s=%s\n", name, value)
return err
}
func MaskInput(input string) {
fmt.Printf("::add-mask::%s\n", input)
}
func Log(format string, a ...any) {
log.Println(fmt.Sprintf(format, a...))
}
func LogError(err error) {
log.Println(err)
}
func SetNotice(format string, a ...any) {
fmt.Printf("::notice::%s\n", fmt.Sprintf(format, a...))
}
func SetWarning(format string, a ...any) {
fmt.Printf("::warning::%s\n", fmt.Sprintf(format, a...))
}
func SetError(format string, a ...any) {
fmt.Printf("::error::%s\n", fmt.Sprintf(format, a...))
}
func Debug(format string, a ...any) {
fmt.Printf("::debug::%s\n", fmt.Sprintf(format, a...))
}
func StartLogGroup(format string, a ...any) {
fmt.Printf("::group::%s\n", fmt.Sprintf(format, a...))
}
func EndLogGroup() {
fmt.Println("::endgroup::")
}