From d3ff1f2fd8c4dac0101374be71834e4d76adf06b Mon Sep 17 00:00:00 2001 From: Ysmr-Ry Date: Tue, 12 Oct 2021 21:38:54 +0900 Subject: [PATCH 01/11] =?UTF-8?q?fix:=20Actions=20=E3=81=9F=E3=81=B6?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- options/locale/locale_ja-JP.ini | 2 ++ templates/repo/header.tmpl | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index 606eea2016abf..e3b00a116159b 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -1621,6 +1621,8 @@ activity.git_stats_and_deletions=、 activity.git_stats_deletion_1=%d行削除 activity.git_stats_deletion_n=%d行削除 +actions=Actions + search=検索 search.search_repo=リポジトリを検索 search.fuzzy=あいまい diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 49a651e6c5a86..74b0a048fe7ad 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -162,6 +162,10 @@ {{end}} + + {{svg "octicon-pulse"}} {{.i18n.Tr "repo.actions"}} + + {{template "custom/extra_tabs" .}} {{if .Permission.IsAdmin}} From 4c484843d1758178436b29a1f69ff46c5d27ca07 Mon Sep 17 00:00:00 2001 From: Ysmr-Ry Date: Thu, 21 Oct 2021 21:46:19 +0900 Subject: [PATCH 02/11] fix: pe-zi tuikaa --- routers/web/repo/actions.go | 28 ++++++++++++++++++++++++++++ routers/web/web.go | 4 ++++ templates/repo/actions.tmpl | 10 ++++++++++ 3 files changed, 42 insertions(+) create mode 100644 routers/web/repo/actions.go create mode 100644 templates/repo/actions.tmpl diff --git a/routers/web/repo/actions.go b/routers/web/repo/actions.go new file mode 100644 index 0000000000000..f6be6abac604b --- /dev/null +++ b/routers/web/repo/actions.go @@ -0,0 +1,28 @@ +// Copyright 2017 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package repo + +import ( + "net/http" + "time" + + "code.gitea.io/gitea/models" + "code.gitea.io/gitea/modules/base" + "code.gitea.io/gitea/modules/context" +) + +const ( + tplActions base.TplName = "repo/actions" +) + +// Github Actions for gitea +func Actions(ctx *context.Context) { + /*ctx.Data["Title"] = ctx.Tr("repo.activity") + ctx.Data["PageIsActivity"] = true + + ctx.Data["Period"] = ctx.Params("period")*/ + + ctx.HTML(http.StatusOK, tplActions) +} diff --git a/routers/web/web.go b/routers/web/web.go index caec0676714c4..b5cedd3ffc534 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -918,6 +918,10 @@ func RegisterRoutes(m *web.Route) { m.Get("/{period}", repo.Activity) }, context.RepoRef(), repo.MustBeNotEmpty, context.RequireRepoReaderOr(models.UnitTypePullRequests, models.UnitTypeIssues, models.UnitTypeReleases)) + m.Group("/actions", func() { + m.Get("", repo.Actions) + }, context.RepoRef(), repo.MustBeNotEmpty) + m.Group("/activity_author_data", func() { m.Get("", repo.ActivityAuthors) m.Get("/{period}", repo.ActivityAuthors) diff --git a/templates/repo/actions.tmpl b/templates/repo/actions.tmpl new file mode 100644 index 0000000000000..dc79d205c5539 --- /dev/null +++ b/templates/repo/actions.tmpl @@ -0,0 +1,10 @@ +{{template "base/head" .}} +
+ {{template "repo/header" .}} +
+ GitHub Actions App
+
+
+{{template "base/footer" .}} From 276598e47d4c9111e2dafb5eccbe62fcec317118 Mon Sep 17 00:00:00 2001 From: Ysmr-Ry Date: Tue, 26 Oct 2021 21:18:23 +0900 Subject: [PATCH 03/11] fix: import error --- routers/web/repo/actions.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/routers/web/repo/actions.go b/routers/web/repo/actions.go index f6be6abac604b..4a327e4313be7 100644 --- a/routers/web/repo/actions.go +++ b/routers/web/repo/actions.go @@ -6,9 +6,7 @@ package repo import ( "net/http" - "time" - "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/base" "code.gitea.io/gitea/modules/context" ) From 55ff34ae136bf09885a28d666b73c37a763fc894 Mon Sep 17 00:00:00 2001 From: Ysmr-Ry Date: Tue, 2 Nov 2021 21:07:08 +0900 Subject: [PATCH 04/11] fix: actions.tmpl --- templates/repo/actions.tmpl | 220 +++++++++++++++++++++++++++++++++++- 1 file changed, 217 insertions(+), 3 deletions(-) diff --git a/templates/repo/actions.tmpl b/templates/repo/actions.tmpl index dc79d205c5539..8f65eafef11ef 100644 --- a/templates/repo/actions.tmpl +++ b/templates/repo/actions.tmpl @@ -2,9 +2,223 @@
{{template "repo/header" .}}
- GitHub Actions App
+
+
{{template "base/footer" .}} From d8de2b3212e16727d7832e5f42abec13db1e5c8d Mon Sep 17 00:00:00 2001 From: Ysmr-Ry Date: Tue, 2 Nov 2021 22:21:58 +0900 Subject: [PATCH 05/11] fix: actions.tmpl --- templates/repo/actions.tmpl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/templates/repo/actions.tmpl b/templates/repo/actions.tmpl index 8f65eafef11ef..1c2485cd7ee0b 100644 --- a/templates/repo/actions.tmpl +++ b/templates/repo/actions.tmpl @@ -43,7 +43,7 @@ const artifactUrl = ghHostApiUrl + "/runner/host/_apis/pipelines/workflows/" + runid + "/artifacts" const response = await fetch(artifactUrl); - const body: string = await response.text() + const body = await response.text() return JSON.parse(body) } @@ -61,11 +61,10 @@ resourceUrl.searchParams.append('itemPath', artifactName) const response = await fetch(resourceUrl.toString()); - const body: string = await response.text() + const body = await response.text() return JSON.parse(body) } - let jobs = []; function setJobs(f) { jobs = f(jobs); } @@ -92,7 +91,7 @@ if(id === undefined) { return; } - var njobs : IJob[] | null; + var njobs; var _id = Number.parseInt(id); if(jobs.length === 0 || jobs.find(x => x.requestId === _id) == null) { njobs = await (await (await fetch(ghHostApiUrl + "/" + owner + "/" + repo + "/_apis/v1/Message", { })).json()) @@ -160,7 +159,7 @@ if(lines.status === 200) { var missingLines = await lines.json(); missingLines.length = e.record.startLine - 1; - s.log.content = missingLines.reduce((prev: string, c : ILogline) => (prev.length > 0 ? prev + "
" : "") + convert.toHtml(c.line), "") + s.log.content; + s.log.content = missingLines.reduce((prev, c ) => (prev.length > 0 ? prev + "
" : "") + convert.toHtml(c.line), "") + s.log.content; } else { console.log("No logs to download..., currently fixes itself"); } @@ -168,7 +167,7 @@ } } if (s.log.id === -1) { - s.log.content = e.record.value.reduce((prev: string, c : string) => (prev.length > 0 ? prev + "
" : "") + convert.toHtml(c), s.log.content); + s.log.content = e.record.value.reduce((prev, c) => (prev.length > 0 ? prev + "
" : "") + convert.toHtml(c), s.log.content); } return true; } @@ -221,4 +220,4 @@ } -{{template "base/footer" .}} +{{template "base/footer" .}} \ No newline at end of file From d49e9a1055c569f26a3807b5abb0e9c5cd72f702 Mon Sep 17 00:00:00 2001 From: Ysmr-Ry Date: Tue, 9 Nov 2021 21:47:11 +0900 Subject: [PATCH 06/11] fix: jobs display --- templates/repo/actions.tmpl | 44 ++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/templates/repo/actions.tmpl b/templates/repo/actions.tmpl index 1c2485cd7ee0b..0efe900706be8 100644 --- a/templates/repo/actions.tmpl +++ b/templates/repo/actions.tmpl @@ -3,7 +3,18 @@ {{template "repo/header" .}}
+
    + +
+ + +
+ +
+ + + + + + {{template "base/footer" .}} \ No newline at end of file From 8bbe6cce011111b75a202f0e0e75641d8225df16 Mon Sep 17 00:00:00 2001 From: velengel Date: Tue, 16 Nov 2021 20:35:08 +0900 Subject: [PATCH 07/11] WIP: fix: lint --- templates/repo/actions.tmpl | 98 ++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/templates/repo/actions.tmpl b/templates/repo/actions.tmpl index 0efe900706be8..5d83d344f5f60 100644 --- a/templates/repo/actions.tmpl +++ b/templates/repo/actions.tmpl @@ -16,45 +16,43 @@ -{{template "base/footer" .}} \ No newline at end of file +{{template 'base/footer' .}} From 12c0ecccd1d598f8ae45f7b9fc2ff26ae95c7e84 Mon Sep 17 00:00:00 2001 From: Ysmr-Ry Date: Tue, 16 Nov 2021 21:48:03 +0900 Subject: [PATCH 09/11] =?UTF-8?q?fix:=20=E8=B5=B7=E5=8B=95=E3=81=97?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/repo/actions.tmpl | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/templates/repo/actions.tmpl b/templates/repo/actions.tmpl index a644beddc2dea..fd5a15bd3650d 100644 --- a/templates/repo/actions.tmpl +++ b/templates/repo/actions.tmpl @@ -1,20 +1,18 @@ -{{template 'base/head' .}} -
- {{template 'repo/header' .}} -
+{{template "base/head" .}} +
+ {{template "repo/header" .}} +
-
    +
    -
    +
    - -