aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2023-06-13 14:05:28 +0800
committerGitHub <noreply@github.com>2023-06-13 06:05:28 +0000
commit419804fd4d5cb655a51f245010b8eb1163b26bc2 (patch)
treed60bd3e695e11acf6b60e7a6be224989514426a1 /routers/api
parent2126f712bfc0ea63705e54abbd14aec54299fa50 (diff)
downloadgitea-419804fd4d5cb655a51f245010b8eb1163b26bc2.tar.gz
gitea-419804fd4d5cb655a51f245010b8eb1163b26bc2.zip
Fix compatible for webhook ref type (#25195)
Fix #25185 Caused by #24634
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/actions/runner/utils.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/routers/api/actions/runner/utils.go b/routers/api/actions/runner/utils.go
index e90213964f..e1d54134c6 100644
--- a/routers/api/actions/runner/utils.go
+++ b/routers/api/actions/runner/utils.go
@@ -98,8 +98,8 @@ func generateTaskContext(t *actions_model.ActionTask) *structpb.Struct {
baseRef = pullPayload.PullRequest.Base.Ref
headRef = pullPayload.PullRequest.Head.Ref
}
+
refName := git.RefName(t.Job.Run.Ref)
- refType := refName.RefGroup()
taskContext, err := structpb.NewStruct(map[string]interface{}{
// standard contexts, see https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
@@ -121,7 +121,7 @@ func generateTaskContext(t *actions_model.ActionTask) *structpb.Struct {
"ref": t.Job.Run.Ref, // string, The fully-formed ref of the branch or tag that triggered the workflow run. For workflows triggered by push, this is the branch or tag ref that was pushed. For workflows triggered by pull_request, this is the pull request merge branch. For workflows triggered by release, this is the release tag created. For other triggers, this is the branch or tag ref that triggered the workflow run. This is only set if a branch or tag is available for the event type. The ref given is fully-formed, meaning that for branches the format is refs/heads/<branch_name>, for pull requests it is refs/pull/<pr_number>/merge, and for tags it is refs/tags/<tag_name>. For example, refs/heads/feature-branch-1.
"ref_name": refName.String(), // string, The short ref name of the branch or tag that triggered the workflow run. This value matches the branch or tag name shown on GitHub. For example, feature-branch-1.
"ref_protected": false, // boolean, true if branch protections are configured for the ref that triggered the workflow run.
- "ref_type": refType, // string, The type of ref that triggered the workflow run. Valid values are branch or tag.
+ "ref_type": refName.RefType(), // string, The type of ref that triggered the workflow run. Valid values are branch or tag.
"path": "", // string, Path on the runner to the file that sets system PATH variables from workflow commands. This file is unique to the current step and is a different file for each step in a job. For more information, see "Workflow commands for GitHub Actions."
"repository": t.Job.Run.Repo.OwnerName + "/" + t.Job.Run.Repo.Name, // string, The owner and repository name. For example, Codertocat/Hello-World.
"repository_owner": t.Job.Run.Repo.OwnerName, // string, The repository owner's name. For example, Codertocat.