From 307c2c63de7e486c785f191ec2e66e7a9b49df80 Mon Sep 17 00:00:00 2001
From: GiteaBot <teabot@gitea.io>
Date: Wed, 17 Aug 2022 14:25:14 +0800
Subject: [PATCH] chore(proto): replace import path.

Signed-off-by: GiteaBot <teabot@gitea.io>
---
 client/client.go   |  4 ++--
 client/http.go     | 16 +++++++++-------
 go.mod             |  2 +-
 go.sum             |  4 ++--
 poller/poller.go   |  6 +++---
 runtime/runtime.go |  6 +++---
 6 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/client/client.go b/client/client.go
index 2a299cc..27aaab9 100644
--- a/client/client.go
+++ b/client/client.go
@@ -3,7 +3,7 @@ package client
 import (
 	"context"
 
-	v1 "gitea.com/gitea/proto/gen/proto/v1"
+	runnerv1 "gitea.com/gitea/proto-go/runner/v1"
 )
 
 // A Client manages communication with the runner.
@@ -12,5 +12,5 @@ type Client interface {
 	Ping(ctx context.Context, machine string) error
 
 	// Request requests the next available build stage for execution.
-	Request(ctx context.Context) (*v1.Stage, error)
+	Request(ctx context.Context) (*runnerv1.Stage, error)
 }
diff --git a/client/http.go b/client/http.go
index c24ca7b..4cf17d4 100644
--- a/client/http.go
+++ b/client/http.go
@@ -7,8 +7,10 @@ import (
 	"net/http"
 	"time"
 
-	v1 "gitea.com/gitea/proto/gen/proto/v1"
-	"gitea.com/gitea/proto/gen/proto/v1/v1connect"
+	pingv1 "gitea.com/gitea/proto-go/ping/v1"
+	"gitea.com/gitea/proto-go/ping/v1/pingv1connect"
+	runnerv1 "gitea.com/gitea/proto-go/runner/v1"
+	"gitea.com/gitea/proto-go/runner/v1/runnerv1connect"
 
 	"github.com/bufbuild/connect-go"
 	"golang.org/x/net/http2"
@@ -69,12 +71,12 @@ type HTTPClient struct {
 
 // Ping sends a ping message to the server to test connectivity.
 func (p *HTTPClient) Ping(ctx context.Context, machine string) error {
-	client := v1connect.NewPingServiceClient(
+	client := pingv1connect.NewPingServiceClient(
 		p.Client,
 		p.Endpoint,
 		p.opts...,
 	)
-	req := connect.NewRequest(&v1.PingRequest{
+	req := connect.NewRequest(&pingv1.PingRequest{
 		Data: machine,
 	})
 
@@ -85,13 +87,13 @@ func (p *HTTPClient) Ping(ctx context.Context, machine string) error {
 }
 
 // Ping sends a ping message to the server to test connectivity.
-func (p *HTTPClient) Request(ctx context.Context) (*v1.Stage, error) {
-	client := v1connect.NewRunnerServiceClient(
+func (p *HTTPClient) Request(ctx context.Context) (*runnerv1.Stage, error) {
+	client := runnerv1connect.NewRunnerServiceClient(
 		p.Client,
 		p.Endpoint,
 		p.opts...,
 	)
-	req := connect.NewRequest(&v1.ConnectRequest{})
+	req := connect.NewRequest(&runnerv1.ConnectRequest{})
 
 	req.Header().Set("X-Gitea-Token", p.Secret)
 
diff --git a/go.mod b/go.mod
index dc59c3a..aa70af2 100644
--- a/go.mod
+++ b/go.mod
@@ -3,7 +3,7 @@ module gitea.com/gitea/act_runner
 go 1.18
 
 require (
-	gitea.com/gitea/proto v0.0.0-20220814042910-32799131d693
+	gitea.com/gitea/proto-go v0.0.0-20220817054638-17fb0016dd41
 	github.com/bufbuild/connect-go v0.3.0
 	github.com/docker/docker v20.10.17+incompatible
 	github.com/joho/godotenv v1.4.0
diff --git a/go.sum b/go.sum
index 44b44fe..4f624cc 100644
--- a/go.sum
+++ b/go.sum
@@ -25,8 +25,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
 gitea.com/gitea/act v0.0.0-20220812010840-c467b06265ee h1:T0wftx4RaYqbTH4t0A7bXGXxemZloCrjReA7xJvIVdY=
 gitea.com/gitea/act v0.0.0-20220812010840-c467b06265ee/go.mod h1:G37Vfz4J6kJ5NbcPI5xQUkeWPVkUCP5J+MFkaWU9jNY=
-gitea.com/gitea/proto v0.0.0-20220814042910-32799131d693 h1:innZDNfMfvOBnvnfuFqCpk2XesFUKyaeFiEbNSsaxsA=
-gitea.com/gitea/proto v0.0.0-20220814042910-32799131d693/go.mod h1:LWD9G0VCMxaDY4I+J3vSqJF5OYNum33pQtRpx43516s=
+gitea.com/gitea/proto-go v0.0.0-20220817054638-17fb0016dd41 h1:FIGF6szYd3lBIwvbeedfU5Lc7uG1Xpzi7bkktS6Vdvg=
+gitea.com/gitea/proto-go v0.0.0-20220817054638-17fb0016dd41/go.mod h1:hD8YwSHusjwjEEgubW6XFvnZuNhMZTHz6lwjfltEt/Y=
 github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
 github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 h1:w+iIsaOQNcT7OZ575w+acHgRric5iCyQh+xv+KJ4HB8=
 github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
diff --git a/poller/poller.go b/poller/poller.go
index b816b43..e55314a 100644
--- a/poller/poller.go
+++ b/poller/poller.go
@@ -5,13 +5,13 @@ import (
 	"errors"
 	"time"
 
-	v1 "gitea.com/gitea/proto/gen/proto/v1"
+	runnerv1 "gitea.com/gitea/proto-go/runner/v1"
 	"gitea.com/gitea/act_runner/client"
 
 	log "github.com/sirupsen/logrus"
 )
 
-func New(cli client.Client, dispatch func(context.Context, *v1.Stage) error) *Poller {
+func New(cli client.Client, dispatch func(context.Context, *runnerv1.Stage) error) *Poller {
 	return &Poller{
 		Client:       cli,
 		Dispatch:     dispatch,
@@ -21,7 +21,7 @@ func New(cli client.Client, dispatch func(context.Context, *v1.Stage) error) *Po
 
 type Poller struct {
 	Client   client.Client
-	Dispatch func(context.Context, *v1.Stage) error
+	Dispatch func(context.Context, *runnerv1.Stage) error
 
 	routineGroup *routineGroup
 }
diff --git a/runtime/runtime.go b/runtime/runtime.go
index a4f9cbb..6f6ad5d 100644
--- a/runtime/runtime.go
+++ b/runtime/runtime.go
@@ -3,7 +3,7 @@ package runtime
 import (
 	"context"
 
-	v1 "gitea.com/gitea/proto/gen/proto/v1"
+	runnerv1 "gitea.com/gitea/proto-go/runner/v1"
 	"gitea.com/gitea/act_runner/client"
 
 	"github.com/sirupsen/logrus"
@@ -17,7 +17,7 @@ type Runner struct {
 }
 
 // Run runs the pipeline stage.
-func (s *Runner) Run(ctx context.Context, stage *v1.Stage) error {
+func (s *Runner) Run(ctx context.Context, stage *runnerv1.Stage) error {
 	l := logrus.
 		WithField("stage.build_uuid", stage.BuildUuid).
 		WithField("stage.runner_uuid", stage.RunnerUuid)
@@ -28,7 +28,7 @@ func (s *Runner) Run(ctx context.Context, stage *v1.Stage) error {
 	return s.run(ctx, stage)
 }
 
-func (s *Runner) run(ctx context.Context, stage *v1.Stage) error {
+func (s *Runner) run(ctx context.Context, stage *runnerv1.Stage) error {
 	l := logrus.
 		WithField("stage.build_uuid", stage.BuildUuid).
 		WithField("stage.runner_uuid", stage.RunnerUuid)