-
Notifications
You must be signed in to change notification settings - Fork 34
/
actions_root.go
129 lines (106 loc) · 3.66 KB
/
actions_root.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// Copyright 2020 The Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package githubactions
import "context"
var (
defaultAction = New()
)
// IssueCommand issues an arbitrary GitHub actions Command.
func IssueCommand(cmd *Command) {
defaultAction.IssueCommand(cmd)
}
// IssueFileCommand issues a new GitHub actions Command using environment files.
func IssueFileCommand(cmd *Command) {
defaultAction.IssueFileCommand(cmd)
}
// AddMask adds a new field mask for the given string "p". After called, future
// attempts to log "p" will be replaced with "***" in log output.
func AddMask(p string) {
defaultAction.AddMask(p)
}
// AddMatcher adds a new matcher with the given file path.
func AddMatcher(p string) {
defaultAction.AddMatcher(p)
}
// RemoveMatcher removes a matcher with the given owner name.
func RemoveMatcher(o string) {
defaultAction.RemoveMatcher(o)
}
// AddPath adds the string "p" to the path for the invocation.
func AddPath(p string) {
defaultAction.AddPath(p)
}
// SaveState saves state to be used in the "finally" post job entry point.
func SaveState(k, v string) {
defaultAction.SaveState(k, v)
}
// GetInput gets the input by the given name.
func GetInput(i string) string {
return defaultAction.GetInput(i)
}
// Group starts a new collapsable region up to the next ungroup invocation.
func Group(t string) {
defaultAction.Group(t)
}
// EndGroup ends the current group.
func EndGroup() {
defaultAction.EndGroup()
}
// SetEnv sets an environment variable.
func SetEnv(k, v string) {
defaultAction.SetEnv(k, v)
}
// SetOutput sets an output parameter.
func SetOutput(k, v string) {
defaultAction.SetOutput(k, v)
}
// Debugf prints a debug-level message. The arguments follow the standard Printf
// arguments.
func Debugf(msg string, args ...interface{}) {
defaultAction.Debugf(msg, args...)
}
// Errorf prints a error-level message. The arguments follow the standard Printf
// arguments.
func Errorf(msg string, args ...interface{}) {
defaultAction.Errorf(msg, args...)
}
// Fatalf prints a error-level message and exits. This is equivalent to Errorf
// followed by os.Exit(1).
func Fatalf(msg string, args ...interface{}) {
defaultAction.Fatalf(msg, args...)
}
// Infof prints a info-level message. The arguments follow the standard Printf
// arguments.
func Infof(msg string, args ...interface{}) {
defaultAction.Infof(msg, args...)
}
// Warningf prints a warning-level message. The arguments follow the standard
// Printf arguments.
func Warningf(msg string, args ...interface{}) {
defaultAction.Warningf(msg, args...)
}
// WithFieldsSlice includes the provided fields in log output. "f" must be a
// slice of k=v pairs. The given slice will be sorted.
func WithFieldsSlice(f []string) *Action {
return defaultAction.WithFieldsSlice(f)
}
// WithFieldsMap includes the provided fields in log output. The fields in "m"
// are automatically converted to k=v pairs and sorted.
func WithFieldsMap(m map[string]string) *Action {
return defaultAction.WithFieldsMap(m)
}
// GetIDToken returns the GitHub OIDC token from the GitHub Actions runtime.
func GetIDToken(ctx context.Context, audience string) (string, error) {
return defaultAction.GetIDToken(ctx, audience)
}