mirror of
https://gitea.com/gitea/act_runner.git
synced 2025-06-13 01:57:13 +02:00
Inject version when building and report version to Gitea via log and header (#43)
close #42 1. Inject runner version when `make build` After building, executing command line: `./act_runner -v` or `./act_runner --version`, the version of runner is printed.  2. In `Actions` UI:  3. Set request header in http client interceptor. Co-authored-by: sillyguodong <gedong_1994@163.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/43 Reviewed-by: delvh <dev.lh@web.de> Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: sillyguodong <sillyguodong@noreply.gitea.io> Co-committed-by: sillyguodong <sillyguodong@noreply.gitea.io>
This commit is contained in:
@ -29,7 +29,7 @@ func getHttpClient(endpoint string, insecure bool) *http.Client {
|
||||
}
|
||||
|
||||
// New returns a new runner client.
|
||||
func New(endpoint string, insecure bool, uuid, token string, opts ...connect.ClientOption) *HTTPClient {
|
||||
func New(endpoint string, insecure bool, uuid, token, runnerVersion string, opts ...connect.ClientOption) *HTTPClient {
|
||||
baseURL := strings.TrimRight(endpoint, "/") + "/api/actions"
|
||||
|
||||
opts = append(opts, connect.WithInterceptors(connect.UnaryInterceptorFunc(func(next connect.UnaryFunc) connect.UnaryFunc {
|
||||
@ -40,6 +40,9 @@ func New(endpoint string, insecure bool, uuid, token string, opts ...connect.Cli
|
||||
if token != "" {
|
||||
req.Header().Set(core.TokenHeader, token)
|
||||
}
|
||||
if runnerVersion != "" {
|
||||
req.Header().Set(core.VersionHeader, runnerVersion)
|
||||
}
|
||||
return next(ctx, req)
|
||||
}
|
||||
})))
|
||||
|
Reference in New Issue
Block a user