File tree Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Expand file tree Collapse file tree 2 files changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -874,6 +874,18 @@ func (rc *RunContext) getGithubContext(ctx context.Context) *model.GithubContext
874874 ghc .APIURL = fmt .Sprintf ("https://%s/api/v3" , rc .Config .GitHubInstance )
875875 ghc .GraphQLURL = fmt .Sprintf ("https://%s/api/graphql" , rc .Config .GitHubInstance )
876876 }
877+
878+ { // Adapt to Gitea
879+ instance := rc .Config .GitHubInstance
880+ if ! strings .HasPrefix (instance , "http://" ) &&
881+ ! strings .HasPrefix (instance , "https://" ) {
882+ instance = "https://" + instance
883+ }
884+ ghc .ServerURL = instance
885+ ghc .APIURL = instance + "/api/v1" // the version of Gitea is v1
886+ ghc .GraphQLURL = "" // Gitea doesn't support graphql
887+ }
888+
877889 // allow to be overridden by user
878890 if rc .Config .Env ["GITHUB_SERVER_URL" ] != "" {
879891 ghc .ServerURL = rc .Config .Env ["GITHUB_SERVER_URL" ]
Original file line number Diff line number Diff line change @@ -49,8 +49,6 @@ func (sar *stepActionRemote) prepareActionExecutor() common.Executor {
4949 }
5050
5151 github := sar .getGithubContext (ctx )
52- sar .remoteAction .URL = github .ServerURL
53-
5452 if sar .remoteAction .IsCheckout () && isLocalCheckout (github , sar .Step ) && ! sar .RunContext .Config .NoSkipCheckout {
5553 common .Logger (ctx ).Debugf ("Skipping local actions/checkout because workdir was already copied" )
5654 return nil
@@ -225,11 +223,7 @@ type remoteAction struct {
225223 Ref string
226224}
227225
228- func (ra * remoteAction ) CloneURL (defaultURL string ) string {
229- u := ra .URL
230- if u == "" {
231- u = defaultURL
232- }
226+ func (ra * remoteAction ) CloneURL (u string ) string {
233227 if ! strings .HasPrefix (u , "http://" ) && ! strings .HasPrefix (u , "https://" ) {
234228 u = "https://" + u
235229 }
@@ -244,6 +238,9 @@ func (ra *remoteAction) IsCheckout() bool {
244238}
245239
246240func (ra * remoteAction ) GetAvailableCloneURL (actionURLs []string ) (string , error ) {
241+ if ra .URL != "" {
242+ return ra .CloneURL (ra .URL ), nil
243+ }
247244 for _ , u := range actionURLs {
248245 cloneURL := ra .CloneURL (u )
249246 resp , err := detectActionClient .Get (cloneURL )
You can’t perform that action at this time.
0 commit comments