From 6840258c9593c0b8ffaf88af0e239d03ed2314d2 Mon Sep 17 00:00:00 2001
From: ChristopherHX
Date: Mon, 27 Mar 2023 10:27:40 +0200
Subject: [PATCH 01/57] Use GitHub Actions compatible globbing for `branches`,
`tag`, `path` filter (#22804)
Replaces the current globbing library with a
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
compatible one.
This adds support for
- `paths-ignore`, `tags-ignore` and `branches-ignore` filters.
- negative patterns in `paths`, `tags` and `branches` filters
- using both `tags` and `paths` filter on the push event
Original PR https://gitea.com/gitea/act/pulls/13.
nektos/act PR https://github.com/nektos/act/pull/1618 for the
workflowpattern package (It can take some months for it to appear in
https://gitea.com/gitea/act)
Related to https://github.com/go-gitea/gitea/issues/13539
---
modules/actions/workflows.go | 142 ++++++++++++++++++++++++++---------
1 file changed, 107 insertions(+), 35 deletions(-)
diff --git a/modules/actions/workflows.go b/modules/actions/workflows.go
index 738026142b94f..1b8b6cc7efb9f 100644
--- a/modules/actions/workflows.go
+++ b/modules/actions/workflows.go
@@ -16,6 +16,7 @@ import (
"github.com/gobwas/glob"
"github.com/nektos/act/pkg/jobparser"
"github.com/nektos/act/pkg/model"
+ "github.com/nektos/act/pkg/workflowpattern"
)
func ListWorkflows(commit *git.Commit) (git.Entries, error) {
@@ -152,40 +153,94 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa
}
matchTimes := 0
+ hasBranchFilter := false
+ hasTagFilter := false
+ refName := git.RefName(pushPayload.Ref)
// all acts conditions should be satisfied
for cond, vals := range evt.Acts {
switch cond {
- case "branches", "tags":
- refShortName := git.RefName(pushPayload.Ref).ShortName()
- for _, val := range vals {
- if glob.MustCompile(val, '/').Match(refShortName) {
- matchTimes++
+ case "branches":
+ hasBranchFilter = true
+ if !refName.IsBranch() {
+ break
+ }
+ patterns, err := workflowpattern.CompilePatterns(vals...)
+ if err != nil {
+ break
+ }
+ if !workflowpattern.Skip(patterns, []string{refName.ShortName()}, &workflowpattern.EmptyTraceWriter{}) {
+ matchTimes++
+ }
+ case "branches-ignore":
+ hasBranchFilter = true
+ if !refName.IsBranch() {
+ break
+ }
+ patterns, err := workflowpattern.CompilePatterns(vals...)
+ if err != nil {
+ break
+ }
+ if !workflowpattern.Filter(patterns, []string{refName.ShortName()}, &workflowpattern.EmptyTraceWriter{}) {
+ matchTimes++
+ }
+ case "tags":
+ hasTagFilter = true
+ if !refName.IsTag() {
+ break
+ }
+ patterns, err := workflowpattern.CompilePatterns(vals...)
+ if err != nil {
+ break
+ }
+ if !workflowpattern.Skip(patterns, []string{refName.ShortName()}, &workflowpattern.EmptyTraceWriter{}) {
+ matchTimes++
+ }
+ case "tags-ignore":
+ hasTagFilter = true
+ if !refName.IsTag() {
+ break
+ }
+ patterns, err := workflowpattern.CompilePatterns(vals...)
+ if err != nil {
+ break
+ }
+ if !workflowpattern.Filter(patterns, []string{refName.ShortName()}, &workflowpattern.EmptyTraceWriter{}) {
+ matchTimes++
+ }
+ case "paths":
+ filesChanged, err := commit.GetFilesChangedSinceCommit(pushPayload.Before)
+ if err != nil {
+ log.Error("GetFilesChangedSinceCommit [commit_sha1: %s]: %v", commit.ID.String(), err)
+ } else {
+ patterns, err := workflowpattern.CompilePatterns(vals...)
+ if err != nil {
break
}
+ if !workflowpattern.Skip(patterns, filesChanged, &workflowpattern.EmptyTraceWriter{}) {
+ matchTimes++
+ }
}
- case "paths":
+ case "paths-ignore":
filesChanged, err := commit.GetFilesChangedSinceCommit(pushPayload.Before)
if err != nil {
log.Error("GetFilesChangedSinceCommit [commit_sha1: %s]: %v", commit.ID.String(), err)
} else {
- for _, val := range vals {
- matched := false
- for _, file := range filesChanged {
- if glob.MustCompile(val, '/').Match(file) {
- matched = true
- break
- }
- }
- if matched {
- matchTimes++
- break
- }
+ patterns, err := workflowpattern.CompilePatterns(vals...)
+ if err != nil {
+ break
+ }
+ if !workflowpattern.Filter(patterns, filesChanged, &workflowpattern.EmptyTraceWriter{}) {
+ matchTimes++
}
}
default:
log.Warn("push event unsupported condition %q", cond)
}
}
+ // if both branch and tag filter are defined in the workflow only one needs to match
+ if hasBranchFilter && hasTagFilter {
+ matchTimes++
+ }
return matchTimes == len(evt.Acts)
}
@@ -237,30 +292,47 @@ func matchPullRequestEvent(commit *git.Commit, prPayload *api.PullRequestPayload
}
}
case "branches":
- refShortName := git.RefName(prPayload.PullRequest.Base.Ref).ShortName()
- for _, val := range vals {
- if glob.MustCompile(val, '/').Match(refShortName) {
- matchTimes++
+ refName := git.RefName(prPayload.PullRequest.Base.Ref)
+ patterns, err := workflowpattern.CompilePatterns(vals...)
+ if err != nil {
+ break
+ }
+ if !workflowpattern.Skip(patterns, []string{refName.ShortName()}, &workflowpattern.EmptyTraceWriter{}) {
+ matchTimes++
+ }
+ case "branches-ignore":
+ refName := git.RefName(prPayload.PullRequest.Base.Ref)
+ patterns, err := workflowpattern.CompilePatterns(vals...)
+ if err != nil {
+ break
+ }
+ if !workflowpattern.Filter(patterns, []string{refName.ShortName()}, &workflowpattern.EmptyTraceWriter{}) {
+ matchTimes++
+ }
+ case "paths":
+ filesChanged, err := commit.GetFilesChangedSinceCommit(prPayload.PullRequest.Base.Ref)
+ if err != nil {
+ log.Error("GetFilesChangedSinceCommit [commit_sha1: %s]: %v", commit.ID.String(), err)
+ } else {
+ patterns, err := workflowpattern.CompilePatterns(vals...)
+ if err != nil {
break
}
+ if !workflowpattern.Skip(patterns, filesChanged, &workflowpattern.EmptyTraceWriter{}) {
+ matchTimes++
+ }
}
- case "paths":
+ case "paths-ignore":
filesChanged, err := commit.GetFilesChangedSinceCommit(prPayload.PullRequest.Base.Ref)
if err != nil {
log.Error("GetFilesChangedSinceCommit [commit_sha1: %s]: %v", commit.ID.String(), err)
} else {
- for _, val := range vals {
- matched := false
- for _, file := range filesChanged {
- if glob.MustCompile(val, '/').Match(file) {
- matched = true
- break
- }
- }
- if matched {
- matchTimes++
- break
- }
+ patterns, err := workflowpattern.CompilePatterns(vals...)
+ if err != nil {
+ break
+ }
+ if !workflowpattern.Filter(patterns, filesChanged, &workflowpattern.EmptyTraceWriter{}) {
+ matchTimes++
}
}
default:
From 22fec1650a01ad85c80381f07d3f9c5ed5216da9 Mon Sep 17 00:00:00 2001
From: yp05327 <576951401@qq.com>
Date: Mon, 27 Mar 2023 19:34:09 +0900
Subject: [PATCH 02/57] Add commit info in action page (#23210)
Add more commit info in action detail page.
![image](https://user-images.githubusercontent.com/18380374/222069905-a5ab28b1-1cea-4eec-b3b9-f1c74145cb82.png)
---
routers/web/repo/actions/view.go | 42 ++++++++++++++++++++++++
web_src/js/components/RepoActionView.vue | 27 +++++++++++++++
2 files changed, 69 insertions(+)
diff --git a/routers/web/repo/actions/view.go b/routers/web/repo/actions/view.go
index 35b99d577d0ad..0fa255b7e65c9 100644
--- a/routers/web/repo/actions/view.go
+++ b/routers/web/repo/actions/view.go
@@ -14,6 +14,7 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/actions"
+ "code.gitea.io/gitea/modules/base"
context_module "code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/timeutil"
@@ -57,6 +58,7 @@ type ViewResponse struct {
CanApprove bool `json:"canApprove"` // the run needs an approval and the doer has permission to approve
Done bool `json:"done"`
Jobs []*ViewJob `json:"jobs"`
+ Commit ViewCommit `json:"commit"`
} `json:"run"`
CurrentJob struct {
Title string `json:"title"`
@@ -76,6 +78,25 @@ type ViewJob struct {
CanRerun bool `json:"canRerun"`
}
+type ViewCommit struct {
+ LocaleCommit string `json:"localeCommit"`
+ LocalePushedBy string `json:"localePushedBy"`
+ ShortSha string `json:"shortSHA"`
+ Link string `json:"link"`
+ Pusher ViewUser `json:"pusher"`
+ Branch ViewBranch `json:"branch"`
+}
+
+type ViewUser struct {
+ DisplayName string `json:"displayName"`
+ Link string `json:"link"`
+}
+
+type ViewBranch struct {
+ Name string `json:"name"`
+ Link string `json:"link"`
+}
+
type ViewJobStep struct {
Summary string `json:"summary"`
Duration string `json:"duration"`
@@ -104,6 +125,10 @@ func ViewPost(ctx *context_module.Context) {
return
}
run := current.Run
+ if err := run.LoadAttributes(ctx); err != nil {
+ ctx.Error(http.StatusInternalServerError, err.Error())
+ return
+ }
resp := &ViewResponse{}
@@ -123,6 +148,23 @@ func ViewPost(ctx *context_module.Context) {
})
}
+ pusher := ViewUser{
+ DisplayName: run.TriggerUser.GetDisplayName(),
+ Link: run.TriggerUser.HomeLink(),
+ }
+ branch := ViewBranch{
+ Name: run.PrettyRef(),
+ Link: run.RefLink(),
+ }
+ resp.State.Run.Commit = ViewCommit{
+ LocaleCommit: ctx.Tr("actions.runs.commit"),
+ LocalePushedBy: ctx.Tr("actions.runs.pushed_by"),
+ ShortSha: base.ShortSha(run.CommitSHA),
+ Link: fmt.Sprintf("%s/commit/%s", run.Repo.Link(), run.CommitSHA),
+ Pusher: pusher,
+ Branch: branch,
+ }
+
var task *actions_model.ActionTask
if current.TaskID > 0 {
var err error
diff --git a/web_src/js/components/RepoActionView.vue b/web_src/js/components/RepoActionView.vue
index 079c81921e156..72801725d029f 100644
--- a/web_src/js/components/RepoActionView.vue
+++ b/web_src/js/components/RepoActionView.vue
@@ -13,6 +13,15 @@
+
@@ -105,6 +114,20 @@ const sfc = {
// canRerun: false,
// },
],
+ commit: {
+ localeCommit: '',
+ localePushedBy: '',
+ shortSHA: '',
+ link: '',
+ pusher: {
+ displayName: '',
+ link: '',
+ },
+ branch: {
+ name: '',
+ link: '',
+ },
+ }
},
currentJob: {
title: '',
@@ -332,6 +355,10 @@ export function initRepositoryActionView() {
padding: 0 5px;
}
+.action-commit-summary {
+ padding: 10px 10px;
+}
+
/* ================ */
/* action view left */
From b78c955958301dde72d8caf189531f6e53c496b4 Mon Sep 17 00:00:00 2001
From: Wiktor Kwapisiewicz
Date: Mon, 27 Mar 2023 15:41:33 +0200
Subject: [PATCH 03/57] Fix tags view (#23243)
This PR fixes several issues reported in
https://github.com/go-gitea/gitea/issues/23221.
It does three things:
1. Fixes the `DefaultBranch` variable that has not been set.
2. Sets `Title` and `Message` for newly created tags from the Tag
message. This makes it easier to create releases from tags that have
messages and for those that don't it doesn't have any effect.
3. Makes UI changes so that tags look more like proper releases.
Before:
![2023-03-02-12-31-19](https://user-images.githubusercontent.com/1718963/222416890-941a74d4-9cd0-4c45-a59e-199d2580cd8c.png)
After:
![2023-03-02-12-31-31](https://user-images.githubusercontent.com/1718963/222416919-abce2009-8955-4cd0-9bed-1374582e04f7.png)
I purposefully didn't reformat the template so that the diff is cleaner
but can do so if that's welcome.
Thanks for your time!
---------
Signed-off-by: Wiktor Kwapisiewicz
---
options/locale/locale_en-US.ini | 2 ++
routers/web/repo/release.go | 8 ++++-
services/repository/push.go | 9 +++--
templates/repo/release/list.tmpl | 62 ++++++++++++--------------------
4 files changed, 38 insertions(+), 43 deletions(-)
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index 12dcd6e0172f3..d09ea26942b4d 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1068,6 +1068,7 @@ release = Release
releases = Releases
tag = Tag
released_this = released this
+tagged_this = tagged this
file.title = %s at %s
file_raw = Raw
file_history = History
@@ -2287,6 +2288,7 @@ release.compare = Compare
release.edit = edit
release.ahead.commits = %d commits
release.ahead.target = to %s since this release
+tag.ahead.target = to %s since this tag
release.source_code = Source Code
release.new_subheader = Releases organize project versions.
release.edit_subheader = Releases organize project versions.
diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go
index e969fdc5ab377..3ffadd34ace7b 100644
--- a/routers/web/repo/release.go
+++ b/routers/web/repo/release.go
@@ -226,8 +226,8 @@ func releasesOrTagsFeed(ctx *context.Context, isReleasesOnly bool, formatType st
// SingleRelease renders a single release's page
func SingleRelease(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("repo.release.releases")
ctx.Data["PageIsReleaseList"] = true
+ ctx.Data["DefaultBranch"] = ctx.Repo.Repository.DefaultBranch
writeAccess := ctx.Repo.CanWrite(unit.TypeReleases)
ctx.Data["CanCreateRelease"] = writeAccess && !ctx.Repo.Repository.IsArchived
@@ -241,6 +241,12 @@ func SingleRelease(ctx *context.Context) {
ctx.ServerError("GetReleasesByRepoID", err)
return
}
+ ctx.Data["PageIsSingleTag"] = release.IsTag
+ if release.IsTag {
+ ctx.Data["Title"] = release.TagName
+ } else {
+ ctx.Data["Title"] = release.Title
+ }
err = repo_model.GetReleaseAttachments(ctx, release)
if err != nil {
diff --git a/services/repository/push.go b/services/repository/push.go
index 4b574e3440679..7f174c71b3f86 100644
--- a/services/repository/push.go
+++ b/services/repository/push.go
@@ -374,15 +374,20 @@ func pushUpdateAddTags(ctx context.Context, repo *repo_model.Repository, gitRepo
rel, has := relMap[lowerTag]
if !has {
+ parts := strings.SplitN(tag.Message, "\n", 2)
+ note := ""
+ if len(parts) > 1 {
+ note = parts[1]
+ }
rel = &repo_model.Release{
RepoID: repo.ID,
- Title: "",
+ Title: parts[0],
TagName: tags[i],
LowerTagName: lowerTag,
Target: "",
Sha1: commit.ID.String(),
NumCommits: commitsCount,
- Note: "",
+ Note: note,
IsDraft: false,
IsPrerelease: false,
IsTag: true,
diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl
index 8b320a956c183..5e5716fa573c5 100644
--- a/templates/repo/release/list.tmpl
+++ b/templates/repo/release/list.tmpl
@@ -5,10 +5,10 @@
{{template "base/alert" .}}
{{if .EnableFeed}}
@@ -35,7 +35,7 @@
From ec261b63e14f84da3e2d9a6e27c8b831a7750677 Mon Sep 17 00:00:00 2001
From: wxiaoguang
Date: Mon, 27 Mar 2023 22:44:51 +0800
Subject: [PATCH 04/57] Refactor repo commit list (#23690)
### Before
* The check of `if PullRequest.BaseRepo.Name` doesn't make sense,
because the `$commitLink` is always constructed below
* Many `if` blocks make the HTML tags (likely) not match in IDE.
Although the rendered result matches, it's very unfriendly to editors or
code analyzer, and it's difficult to read.
### After
Move the `$commitLink` assignment ahead.
Simplify the code, resolve the above problems.
---
templates/repo/commits_list_small.tmpl | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/templates/repo/commits_list_small.tmpl b/templates/repo/commits_list_small.tmpl
index 7c34a8f09e9bf..40a9843c82e17 100644
--- a/templates/repo/commits_list_small.tmpl
+++ b/templates/repo/commits_list_small.tmpl
@@ -13,6 +13,8 @@
{{avatarByEmail $.root.Context .Author.Email .Author.Name}}
{{end}}
+ {{$commitLink:= printf "%s/commit/%s" $.comment.Issue.PullRequest.BaseRepo.Link (PathEscape .ID.String)}}
+
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $.root}}
{{$class := "ui sha label"}}
@@ -30,23 +32,14 @@
{{$class = (printf "%s%s" $class " isWarning")}}
{{end}}
{{end}}
- {{if $.comment.Issue.PullRequest.BaseRepo.Name}}
-
- {{else}}
-
- {{end}}
- {{ShortSha .ID.String}}
- {{if .Signature}}
- {{template "repo/shabox_badge" dict "root" $.root "verification" .Verification}}
- {{end}}
- {{if $.comment.Issue.PullRequest.BaseRepo.Name}}
-
- {{else}}
-
- {{end}}
+
+ {{ShortSha .ID.String}}
+ {{if .Signature}}
+ {{template "repo/shabox_badge" dict "root" $.root "verification" .Verification}}
+ {{end}}
+
- {{$commitLink:= printf "%s/commit/%s" $.comment.Issue.PullRequest.BaseRepo.Link (PathEscape .ID.String)}}
{{RenderCommitMessageLinkSubject $.root.Context .Message ($.comment.Issue.PullRequest.BaseRepo.Link|Escape) $commitLink $.comment.Issue.PullRequest.BaseRepo.ComposeMetas}}
{{if IsMultilineCommitMessage .Message}}
From 31ab331b233d09568d47ffa25ea5516282d8e71b Mon Sep 17 00:00:00 2001
From: wxiaoguang
Date: Tue, 28 Mar 2023 00:05:51 +0800
Subject: [PATCH 05/57] Remove incorrect HTML self close tag (#23748)
HTML is not XML.
---
templates/admin/auth/edit.tmpl | 10 +++++-----
templates/admin/auth/new.tmpl | 2 +-
templates/admin/auth/source/oauth.tmpl | 10 +++++-----
templates/admin/cron.tmpl | 2 +-
templates/admin/dashboard.tmpl | 4 ++--
templates/admin/user/edit.tmpl | 2 +-
templates/api/packages/pypi/simple.tmpl | 2 +-
templates/home.tmpl | 2 +-
templates/install.tmpl | 2 +-
templates/mail/auth/activate.tmpl | 4 ++--
templates/mail/auth/activate_email.tmpl | 4 ++--
templates/mail/auth/register_notify.tmpl | 4 ++--
templates/mail/auth/reset_passwd.tmpl | 4 ++--
templates/mail/issue/assigned.tmpl | 2 +-
templates/mail/issue/default.tmpl | 2 +-
templates/mail/notify/collaborator.tmpl | 2 +-
templates/mail/notify/repo_transfer.tmpl | 2 +-
templates/mail/release.tmpl | 2 +-
templates/mail/team_invite.tmpl | 4 ++--
templates/org/create.tmpl | 8 ++++----
templates/org/settings/options.tmpl | 8 ++++----
templates/org/team/members.tmpl | 2 +-
templates/org/team/sidebar.tmpl | 2 +-
templates/post-install.tmpl | 2 +-
templates/repo/commit_page.tmpl | 2 +-
templates/repo/create.tmpl | 4 ++--
templates/repo/diff/comment_form.tmpl | 2 +-
templates/repo/diff/image_diff.tmpl | 14 +++++++-------
templates/repo/diff/new_review.tmpl | 2 +-
templates/repo/graph/svgcontainer.tmpl | 4 ++--
templates/repo/issue/choose.tmpl | 4 ++--
.../repo/issue/labels/edit_delete_label.tmpl | 2 +-
.../repo/issue/labels/label_load_template.tmpl | 4 ++--
templates/repo/issue/labels/label_new.tmpl | 2 +-
templates/repo/issue/milestones.tmpl | 2 +-
templates/repo/issue/search.tmpl | 14 +++++++-------
templates/repo/issue/view_content.tmpl | 2 +-
templates/repo/issue/view_content/sidebar.tmpl | 6 +++---
templates/repo/migrate/migrating.tmpl | 4 ++--
templates/repo/projects/view.tmpl | 2 +-
templates/repo/pulls/files.tmpl | 2 +-
templates/repo/release/new.tmpl | 8 ++++----
templates/repo/settings/lfs_pointers.tmpl | 2 +-
templates/repo/settings/options.tmpl | 8 ++++----
templates/repo/settings/tags.tmpl | 2 +-
templates/status/404.tmpl | 2 +-
templates/status/500.tmpl | 2 +-
templates/user/auth/grant.tmpl | 2 +-
templates/user/dashboard/issues.tmpl | 8 ++++----
templates/user/dashboard/milestones.tmpl | 8 ++++----
.../user/notification/notification_div.tmpl | 16 ++++++++--------
templates/user/profile.tmpl | 2 +-
templates/user/settings/profile.tmpl | 2 +-
53 files changed, 111 insertions(+), 111 deletions(-)
diff --git a/templates/admin/auth/edit.tmpl b/templates/admin/auth/edit.tmpl
index c798be02ff7fd..9b07774653478 100644
--- a/templates/admin/auth/edit.tmpl
+++ b/templates/admin/auth/edit.tmpl
@@ -328,11 +328,11 @@
{{range .OAuth2Providers}}{{if .CustomURLSettings}}
-
-
-
-
-
+
+
+
+
+
{{end}}{{end}}
diff --git a/templates/admin/auth/new.tmpl b/templates/admin/auth/new.tmpl
index 9078fda469b76..b7715cb5fe425 100644
--- a/templates/admin/auth/new.tmpl
+++ b/templates/admin/auth/new.tmpl
@@ -38,7 +38,7 @@
-
+
diff --git a/templates/admin/auth/source/oauth.tmpl b/templates/admin/auth/source/oauth.tmpl
index 1080937f9134c..e4ae736e8fa6c 100644
--- a/templates/admin/auth/source/oauth.tmpl
+++ b/templates/admin/auth/source/oauth.tmpl
@@ -65,11 +65,11 @@
{{range .OAuth2Providers}}{{if .CustomURLSettings}}
-
-
-
-
-
+
+
+
+
+
{{end}}{{end}}
diff --git a/templates/admin/cron.tmpl b/templates/admin/cron.tmpl
index e03208e5c8194..29e4bc09bcaad 100644
--- a/templates/admin/cron.tmpl
+++ b/templates/admin/cron.tmpl
@@ -29,7 +29,7 @@
{{end}}
-
+
{{.CsrfTokenHtml}}
diff --git a/templates/admin/dashboard.tmpl b/templates/admin/dashboard.tmpl
index 40f28068d7d63..d2ba1e2b010db 100644
--- a/templates/admin/dashboard.tmpl
+++ b/templates/admin/dashboard.tmpl
@@ -42,12 +42,12 @@
|
{{if and (not .SSH.Disabled) (not .SSH.StartBuiltinServer)}}
- {{.locale.Tr "admin.dashboard.resync_all_sshkeys"}}
+ | {{.locale.Tr "admin.dashboard.resync_all_sshkeys"}}
{{.locale.Tr "admin.dashboard.resync_all_sshkeys.desc"}} |
|
- {{.locale.Tr "admin.dashboard.resync_all_sshprincipals"}}
+ | {{.locale.Tr "admin.dashboard.resync_all_sshprincipals"}}
{{.locale.Tr "admin.dashboard.resync_all_sshprincipals.desc"}} |
|
diff --git a/templates/admin/user/edit.tmpl b/templates/admin/user/edit.tmpl
index 236894af4d4c2..4fd0d892f258d 100644
--- a/templates/admin/user/edit.tmpl
+++ b/templates/admin/user/edit.tmpl
@@ -171,7 +171,7 @@
-
+
{{end}}
diff --git a/templates/api/packages/pypi/simple.tmpl b/templates/api/packages/pypi/simple.tmpl
index d8e480d9c675d..77cb035600b26 100644
--- a/templates/api/packages/pypi/simple.tmpl
+++ b/templates/api/packages/pypi/simple.tmpl
@@ -8,7 +8,7 @@
{{range .PackageDescriptors}}
{{$p := .}}
{{range .Files}}
-
{{.File.Name}}
+
{{.File.Name}}
{{end}}
{{end}}
diff --git a/templates/home.tmpl b/templates/home.tmpl
index 52ad1b12dfc1e..cc1026ce9e7d7 100644
--- a/templates/home.tmpl
+++ b/templates/home.tmpl
@@ -3,7 +3,7 @@
-
+
-
+
{{template "base/footer" .}}
diff --git a/templates/mail/auth/activate.tmpl b/templates/mail/auth/activate.tmpl
index 75a0b8564abc0..a15afe3d49b7d 100644
--- a/templates/mail/auth/activate.tmpl
+++ b/templates/mail/auth/activate.tmpl
@@ -1,8 +1,8 @@
-
-
+
+
{{.locale.Tr "mail.activate_account.title" (.DisplayName|DotEscape)}}
diff --git a/templates/mail/auth/activate_email.tmpl b/templates/mail/auth/activate_email.tmpl
index 0a24dc19c8120..b15cc2a68a7e7 100644
--- a/templates/mail/auth/activate_email.tmpl
+++ b/templates/mail/auth/activate_email.tmpl
@@ -1,8 +1,8 @@
-
-
+
+
{{.locale.Tr "mail.activate_email.title" (.DisplayName|DotEscape)}}
diff --git a/templates/mail/auth/register_notify.tmpl b/templates/mail/auth/register_notify.tmpl
index 673e84c5c78ef..3cdb456fb38ce 100644
--- a/templates/mail/auth/register_notify.tmpl
+++ b/templates/mail/auth/register_notify.tmpl
@@ -1,8 +1,8 @@
-
-
+
+
{{.locale.Tr "mail.register_notify.title" (.DisplayName|DotEscape) AppName}}
diff --git a/templates/mail/auth/reset_passwd.tmpl b/templates/mail/auth/reset_passwd.tmpl
index 6a3625ab78266..172844c954f4a 100644
--- a/templates/mail/auth/reset_passwd.tmpl
+++ b/templates/mail/auth/reset_passwd.tmpl
@@ -1,8 +1,8 @@
-
-
+
+
{{.locale.Tr "mail.reset_password.title" (.DisplayName|DotEscape)}}
diff --git a/templates/mail/issue/assigned.tmpl b/templates/mail/issue/assigned.tmpl
index 05bed6902221d..d02ea399189f1 100644
--- a/templates/mail/issue/assigned.tmpl
+++ b/templates/mail/issue/assigned.tmpl
@@ -4,7 +4,7 @@
-
+
{{.Subject}}
diff --git a/templates/mail/issue/default.tmpl b/templates/mail/issue/default.tmpl
index 64dbb3df681e4..422a4f0461108 100644
--- a/templates/mail/issue/default.tmpl
+++ b/templates/mail/issue/default.tmpl
@@ -1,7 +1,7 @@
-
+
{{.Subject}}
-
+
{{.Subject}}
diff --git a/templates/mail/notify/repo_transfer.tmpl b/templates/mail/notify/repo_transfer.tmpl
index 85ed96f3f734b..586f83e652586 100644
--- a/templates/mail/notify/repo_transfer.tmpl
+++ b/templates/mail/notify/repo_transfer.tmpl
@@ -1,7 +1,7 @@
-
+
{{.Subject}}
diff --git a/templates/mail/release.tmpl b/templates/mail/release.tmpl
index b2acdce8b2b48..f588d8224f3a2 100644
--- a/templates/mail/release.tmpl
+++ b/templates/mail/release.tmpl
@@ -1,7 +1,7 @@
-
+
{{.Subject}}
From 964a057a76793c32c81394505e2f480a4bf40d0d Mon Sep 17 00:00:00 2001
From: Jason Song
Date: Thu, 30 Mar 2023 22:33:17 +0800
Subject: [PATCH 29/57] Fix checks for `needs` in Actions (#23789)
Fix:
- https://gitea.com/gitea/act_runner/issues/77
- https://gitea.com/gitea/act_runner/issues/81
Before:
Highlights:
- Upgrade act to make things doable, related to
- https://gitea.com/gitea/act/pulls/32
- https://gitea.com/gitea/act/pulls/33
- https://gitea.com/gitea/act/pulls/35
- Make `needs` works
- Sort jobs in the original order in the workflow files
---
go.mod | 2 +-
go.sum | 4 ++--
models/actions/run.go | 4 +++-
modules/actions/workflows.go | 28 ++++++++++++------------
web_src/js/components/RepoActionView.vue | 5 ++---
5 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/go.mod b/go.mod
index ba7ab27c193e7..1ee95b9f59063 100644
--- a/go.mod
+++ b/go.mod
@@ -289,7 +289,7 @@ replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142
replace github.com/blevesearch/zapx/v15 v15.3.6 => github.com/zeripath/zapx/v15 v15.3.6-alignment-fix
-replace github.com/nektos/act => gitea.com/gitea/act v0.243.1
+replace github.com/nektos/act => gitea.com/gitea/act v0.243.2-0.20230329055922-5e76853b55ab
exclude github.com/gofrs/uuid v3.2.0+incompatible
diff --git a/go.sum b/go.sum
index 0faea93e2273e..6bbbbf6eea086 100644
--- a/go.sum
+++ b/go.sum
@@ -52,8 +52,8 @@ codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570/go.mod h1:IIAjsi
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 h1:cliQ4HHsCo6xi2oWZYKWW4bly/Ory9FuTpFPRxj/mAg=
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078/go.mod h1:g/V2Hjas6Z1UHUp4yIx6bATpNzJ7DYtD0FG3+xARWxs=
-gitea.com/gitea/act v0.243.1 h1:zIVlhGOLE4SHFPW++u3+5Y/jX5mub3QIhB13oNf6rtA=
-gitea.com/gitea/act v0.243.1/go.mod h1:iLHCXqOPUElA2nSyHo4wtxSmvdkym3WU7CkP3AxF39Q=
+gitea.com/gitea/act v0.243.2-0.20230329055922-5e76853b55ab h1:HDImhO/XpMJrw2PJcADI/wgur9Gro/pegLFaRt8Wpg0=
+gitea.com/gitea/act v0.243.2-0.20230329055922-5e76853b55ab/go.mod h1:mabw6AZAiDgxGlK83orWLrNERSPvgBJzEUS3S7u2bHI=
gitea.com/go-chi/binding v0.0.0-20221013104517-b29891619681 h1:MMSPgnVULVwV9kEBgvyEUhC9v/uviZ55hPJEMjpbNR4=
gitea.com/go-chi/binding v0.0.0-20221013104517-b29891619681/go.mod h1:77TZu701zMXWJFvB8gvTbQ92zQ3DQq/H7l5wAEjQRKc=
gitea.com/go-chi/cache v0.0.0-20210110083709-82c4c9ce2d5e/go.mod h1:k2V/gPDEtXGjjMGuBJiapffAXTv76H4snSmlJRLUhH0=
diff --git a/models/actions/run.go b/models/actions/run.go
index 1af8f897fa08a..22041b65a9b1a 100644
--- a/models/actions/run.go
+++ b/models/actions/run.go
@@ -197,7 +197,9 @@ func InsertRun(ctx context.Context, run *ActionRun, jobs []*jobparser.SingleWork
for _, v := range jobs {
id, job := v.Job()
needs := job.Needs()
- job.EraseNeeds()
+ if err := v.SetJob(id, job.EraseNeeds()); err != nil {
+ return err
+ }
payload, _ := v.Marshal()
status := StatusWaiting
if len(needs) > 0 || run.NeedApproval {
diff --git a/modules/actions/workflows.go b/modules/actions/workflows.go
index 1b8b6cc7efb9f..76c144bb2b0f5 100644
--- a/modules/actions/workflows.go
+++ b/modules/actions/workflows.go
@@ -122,8 +122,8 @@ func detectMatched(commit *git.Commit, triggedEvent webhook_module.HookEventType
webhook_module.HookEventRepository,
webhook_module.HookEventRelease,
webhook_module.HookEventPackage:
- if len(evt.Acts) != 0 {
- log.Warn("Ignore unsupported %s event arguments %q", triggedEvent, evt.Acts)
+ if len(evt.Acts()) != 0 {
+ log.Warn("Ignore unsupported %s event arguments %v", triggedEvent, evt.Acts())
}
// no special filter parameters for these events, just return true if name matched
return true
@@ -148,7 +148,7 @@ func detectMatched(commit *git.Commit, triggedEvent webhook_module.HookEventType
func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobparser.Event) bool {
// with no special filter parameters
- if len(evt.Acts) == 0 {
+ if len(evt.Acts()) == 0 {
return true
}
@@ -157,7 +157,7 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa
hasTagFilter := false
refName := git.RefName(pushPayload.Ref)
// all acts conditions should be satisfied
- for cond, vals := range evt.Acts {
+ for cond, vals := range evt.Acts() {
switch cond {
case "branches":
hasBranchFilter = true
@@ -241,18 +241,18 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa
if hasBranchFilter && hasTagFilter {
matchTimes++
}
- return matchTimes == len(evt.Acts)
+ return matchTimes == len(evt.Acts())
}
func matchIssuesEvent(commit *git.Commit, issuePayload *api.IssuePayload, evt *jobparser.Event) bool {
// with no special filter parameters
- if len(evt.Acts) == 0 {
+ if len(evt.Acts()) == 0 {
return true
}
matchTimes := 0
// all acts conditions should be satisfied
- for cond, vals := range evt.Acts {
+ for cond, vals := range evt.Acts() {
switch cond {
case "types":
for _, val := range vals {
@@ -265,19 +265,19 @@ func matchIssuesEvent(commit *git.Commit, issuePayload *api.IssuePayload, evt *j
log.Warn("issue event unsupported condition %q", cond)
}
}
- return matchTimes == len(evt.Acts)
+ return matchTimes == len(evt.Acts())
}
func matchPullRequestEvent(commit *git.Commit, prPayload *api.PullRequestPayload, evt *jobparser.Event) bool {
// with no special filter parameters
- if len(evt.Acts) == 0 {
+ if len(evt.Acts()) == 0 {
// defaultly, only pull request opened and synchronized will trigger workflow
return prPayload.Action == api.HookIssueSynchronized || prPayload.Action == api.HookIssueOpened
}
matchTimes := 0
// all acts conditions should be satisfied
- for cond, vals := range evt.Acts {
+ for cond, vals := range evt.Acts() {
switch cond {
case "types":
action := prPayload.Action
@@ -339,18 +339,18 @@ func matchPullRequestEvent(commit *git.Commit, prPayload *api.PullRequestPayload
log.Warn("pull request event unsupported condition %q", cond)
}
}
- return matchTimes == len(evt.Acts)
+ return matchTimes == len(evt.Acts())
}
func matchIssueCommentEvent(commit *git.Commit, issueCommentPayload *api.IssueCommentPayload, evt *jobparser.Event) bool {
// with no special filter parameters
- if len(evt.Acts) == 0 {
+ if len(evt.Acts()) == 0 {
return true
}
matchTimes := 0
// all acts conditions should be satisfied
- for cond, vals := range evt.Acts {
+ for cond, vals := range evt.Acts() {
switch cond {
case "types":
for _, val := range vals {
@@ -363,5 +363,5 @@ func matchIssueCommentEvent(commit *git.Commit, issueCommentPayload *api.IssueCo
log.Warn("issue comment unsupported condition %q", cond)
}
}
- return matchTimes == len(evt.Acts)
+ return matchTimes == len(evt.Acts())
}
diff --git a/web_src/js/components/RepoActionView.vue b/web_src/js/components/RepoActionView.vue
index 72801725d029f..ebc42829b478e 100644
--- a/web_src/js/components/RepoActionView.vue
+++ b/web_src/js/components/RepoActionView.vue
@@ -1,7 +1,7 @@