You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

header.tmpl 11KB

Implement actions (#21937) Close #13539. Co-authored by: @lunny @appleboy @fuxiaohei and others. Related projects: - https://gitea.com/gitea/actions-proto-def - https://gitea.com/gitea/actions-proto-go - https://gitea.com/gitea/act - https://gitea.com/gitea/act_runner ### Summary The target of this PR is to bring a basic implementation of "Actions", an internal CI/CD system of Gitea. That means even though it has been merged, the state of the feature is **EXPERIMENTAL**, and please note that: - It is disabled by default; - It shouldn't be used in a production environment currently; - It shouldn't be used in a public Gitea instance currently; - Breaking changes may be made before it's stable. **Please comment on #13539 if you have any different product design ideas**, all decisions reached there will be adopted here. But in this PR, we don't talk about **naming, feature-creep or alternatives**. ### ⚠️ Breaking `gitea-actions` will become a reserved user name. If a user with the name already exists in the database, it is recommended to rename it. ### Some important reviews - What is `DEFAULT_ACTIONS_URL` in `app.ini` for? - https://github.com/go-gitea/gitea/pull/21937#discussion_r1055954954 - Why the api for runners is not under the normal `/api/v1` prefix? - https://github.com/go-gitea/gitea/pull/21937#discussion_r1061173592 - Why DBFS? - https://github.com/go-gitea/gitea/pull/21937#discussion_r1061301178 - Why ignore events triggered by `gitea-actions` bot? - https://github.com/go-gitea/gitea/pull/21937#discussion_r1063254103 - Why there's no permission control for actions? - https://github.com/go-gitea/gitea/pull/21937#discussion_r1090229868 ### What it looks like <details> #### Manage runners <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205870657-c72f590e-2e08-4cd4-be7f-2e0abb299bbf.png"> #### List runs <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205872794-50fde990-2b45-48c1-a178-908e4ec5b627.png"> #### View logs <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205872501-9b7b9000-9542-4991-8f55-18ccdada77c3.png"> </details> ### How to try it <details> #### 1. Start Gitea Clone this branch and [install from source](https://docs.gitea.io/en-us/install-from-source). Add additional configurations in `app.ini` to enable Actions: ```ini [actions] ENABLED = true ``` Start it. If all is well, you'll see the management page of runners: <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205877365-8e30a780-9b10-4154-b3e8-ee6c3cb35a59.png"> #### 2. Start runner Clone the [act_runner](https://gitea.com/gitea/act_runner), and follow the [README](https://gitea.com/gitea/act_runner/src/branch/main/README.md) to start it. If all is well, you'll see a new runner has been added: <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205878000-216f5937-e696-470d-b66c-8473987d91c3.png"> #### 3. Enable actions for a repo Create a new repo or open an existing one, check the `Actions` checkbox in settings and submit. <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205879705-53e09208-73c0-4b3e-a123-2dcf9aba4b9c.png"> <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205879383-23f3d08f-1a85-41dd-a8b3-54e2ee6453e8.png"> If all is well, you'll see a new tab "Actions": <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205881648-a8072d8c-5803-4d76-b8a8-9b2fb49516c1.png"> #### 4. Upload workflow files Upload some workflow files to `.gitea/workflows/xxx.yaml`, you can follow the [quickstart](https://docs.github.com/en/actions/quickstart) of GitHub Actions. Yes, Gitea Actions is compatible with GitHub Actions in most cases, you can use the same demo: ```yaml name: GitHub Actions Demo run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 on: [push] jobs: Explore-GitHub-Actions: runs-on: ubuntu-latest steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - name: Check out repository code uses: actions/checkout@v3 - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - run: echo "🖥️ The workflow is now ready to test your code on the runner." - name: List files in the repository run: | ls ${{ github.workspace }} - run: echo "🍏 This job's status is ${{ job.status }}." ``` If all is well, you'll see a new run in `Actions` tab: <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205884473-79a874bc-171b-4aaf-acd5-0241a45c3b53.png"> #### 5. Check the logs of jobs Click a run and you'll see the logs: <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205884800-994b0374-67f7-48ff-be9a-4c53f3141547.png"> #### 6. Go on You can try more examples in [the documents](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) of GitHub Actions, then you might find a lot of bugs. Come on, PRs are welcome. </details> See also: [Feature Preview: Gitea Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/) --------- Co-authored-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: ChristopherHX <christopher.homberger@web.de> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
1 year ago
Implement actions (#21937) Close #13539. Co-authored by: @lunny @appleboy @fuxiaohei and others. Related projects: - https://gitea.com/gitea/actions-proto-def - https://gitea.com/gitea/actions-proto-go - https://gitea.com/gitea/act - https://gitea.com/gitea/act_runner ### Summary The target of this PR is to bring a basic implementation of "Actions", an internal CI/CD system of Gitea. That means even though it has been merged, the state of the feature is **EXPERIMENTAL**, and please note that: - It is disabled by default; - It shouldn't be used in a production environment currently; - It shouldn't be used in a public Gitea instance currently; - Breaking changes may be made before it's stable. **Please comment on #13539 if you have any different product design ideas**, all decisions reached there will be adopted here. But in this PR, we don't talk about **naming, feature-creep or alternatives**. ### ⚠️ Breaking `gitea-actions` will become a reserved user name. If a user with the name already exists in the database, it is recommended to rename it. ### Some important reviews - What is `DEFAULT_ACTIONS_URL` in `app.ini` for? - https://github.com/go-gitea/gitea/pull/21937#discussion_r1055954954 - Why the api for runners is not under the normal `/api/v1` prefix? - https://github.com/go-gitea/gitea/pull/21937#discussion_r1061173592 - Why DBFS? - https://github.com/go-gitea/gitea/pull/21937#discussion_r1061301178 - Why ignore events triggered by `gitea-actions` bot? - https://github.com/go-gitea/gitea/pull/21937#discussion_r1063254103 - Why there's no permission control for actions? - https://github.com/go-gitea/gitea/pull/21937#discussion_r1090229868 ### What it looks like <details> #### Manage runners <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205870657-c72f590e-2e08-4cd4-be7f-2e0abb299bbf.png"> #### List runs <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205872794-50fde990-2b45-48c1-a178-908e4ec5b627.png"> #### View logs <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205872501-9b7b9000-9542-4991-8f55-18ccdada77c3.png"> </details> ### How to try it <details> #### 1. Start Gitea Clone this branch and [install from source](https://docs.gitea.io/en-us/install-from-source). Add additional configurations in `app.ini` to enable Actions: ```ini [actions] ENABLED = true ``` Start it. If all is well, you'll see the management page of runners: <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205877365-8e30a780-9b10-4154-b3e8-ee6c3cb35a59.png"> #### 2. Start runner Clone the [act_runner](https://gitea.com/gitea/act_runner), and follow the [README](https://gitea.com/gitea/act_runner/src/branch/main/README.md) to start it. If all is well, you'll see a new runner has been added: <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205878000-216f5937-e696-470d-b66c-8473987d91c3.png"> #### 3. Enable actions for a repo Create a new repo or open an existing one, check the `Actions` checkbox in settings and submit. <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205879705-53e09208-73c0-4b3e-a123-2dcf9aba4b9c.png"> <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205879383-23f3d08f-1a85-41dd-a8b3-54e2ee6453e8.png"> If all is well, you'll see a new tab "Actions": <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205881648-a8072d8c-5803-4d76-b8a8-9b2fb49516c1.png"> #### 4. Upload workflow files Upload some workflow files to `.gitea/workflows/xxx.yaml`, you can follow the [quickstart](https://docs.github.com/en/actions/quickstart) of GitHub Actions. Yes, Gitea Actions is compatible with GitHub Actions in most cases, you can use the same demo: ```yaml name: GitHub Actions Demo run-name: ${{ github.actor }} is testing out GitHub Actions 🚀 on: [push] jobs: Explore-GitHub-Actions: runs-on: ubuntu-latest steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - name: Check out repository code uses: actions/checkout@v3 - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - run: echo "🖥️ The workflow is now ready to test your code on the runner." - name: List files in the repository run: | ls ${{ github.workspace }} - run: echo "🍏 This job's status is ${{ job.status }}." ``` If all is well, you'll see a new run in `Actions` tab: <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205884473-79a874bc-171b-4aaf-acd5-0241a45c3b53.png"> #### 5. Check the logs of jobs Click a run and you'll see the logs: <img width="1792" alt="image" src="https://user-images.githubusercontent.com/9418365/205884800-994b0374-67f7-48ff-be9a-4c53f3141547.png"> #### 6. Go on You can try more examples in [the documents](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) of GitHub Actions, then you might find a lot of bugs. Come on, PRs are welcome. </details> See also: [Feature Preview: Gitea Actions](https://blog.gitea.io/2022/12/feature-preview-gitea-actions/) --------- Co-authored-by: a1012112796 <1012112796@qq.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: ChristopherHX <christopher.homberger@web.de> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
1 year ago
Add Package Registry (#16510) * Added package store settings. * Added models. * Added generic package registry. * Added tests. * Added NuGet package registry. * Moved service index to api file. * Added NPM package registry. * Added Maven package registry. * Added PyPI package registry. * Summary is deprecated. * Changed npm name. * Sanitize project url. * Allow only scoped packages. * Added user interface. * Changed method name. * Added missing migration file. * Set page info. * Added documentation. * Added documentation links. * Fixed wrong error message. * Lint template files. * Fixed merge errors. * Fixed unit test storage path. * Switch to json module. * Added suggestions. * Added package webhook. * Add package api. * Fixed swagger file. * Fixed enum and comments. * Fixed NuGet pagination. * Print test names. * Added api tests. * Fixed access level. * Fix User unmarshal. * Added RubyGems package registry. * Fix lint. * Implemented io.Writer. * Added support for sha256/sha512 checksum files. * Improved maven-metadata.xml support. * Added support for symbol package uploads. * Added tests. * Added overview docs. * Added npm dependencies and keywords. * Added no-packages information. * Display file size. * Display asset count. * Fixed filter alignment. * Added package icons. * Formatted instructions. * Allow anonymous package downloads. * Fixed comments. * Fixed postgres test. * Moved file. * Moved models to models/packages. * Use correct error response format per client. * Use simpler search form. * Fixed IsProd. * Restructured data model. * Prevent empty filename. * Fix swagger. * Implemented user/org registry. * Implemented UI. * Use GetUserByIDCtx. * Use table for dependencies. * make svg * Added support for unscoped npm packages. * Add support for npm dist tags. * Added tests for npm tags. * Unlink packages if repository gets deleted. * Prevent user/org delete if a packages exist. * Use package unlink in repository service. * Added support for composer packages. * Restructured package docs. * Added missing tests. * Fixed generic content page. * Fixed docs. * Fixed swagger. * Added missing type. * Fixed ambiguous column. * Organize content store by sha256 hash. * Added admin package management. * Added support for sorting. * Add support for multiple identical versions/files. * Added missing repository unlink. * Added file properties. * make fmt * lint * Added Conan package registry. * Updated docs. * Unify package names. * Added swagger enum. * Use longer TEXT column type. * Removed version composite key. * Merged package and container registry. * Removed index. * Use dedicated package router. * Moved files to new location. * Updated docs. * Fixed JOIN order. * Fixed GROUP BY statement. * Fixed GROUP BY #2. * Added symbol server support. * Added more tests. * Set NOT NULL. * Added setting to disable package registries. * Moved auth into service. * refactor * Use ctx everywhere. * Added package cleanup task. * Changed packages path. * Added container registry. * Refactoring * Updated comparison. * Fix swagger. * Fixed table order. * Use token auth for npm routes. * Enabled ReverseProxy auth. * Added packages link for orgs. * Fixed anonymous org access. * Enable copy button for setup instructions. * Merge error * Added suggestions. * Fixed merge. * Handle "generic". * Added link for TODO. * Added suggestions. * Changed temporary buffer filename. * Added suggestions. * Apply suggestions from code review Co-authored-by: Thomas Boerger <thomas@webhippie.de> * Update docs/content/doc/packages/nuget.en-us.md Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Thomas Boerger <thomas@webhippie.de>
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <div class="header-wrapper">
  2. {{with .Repository}}
  3. <div class="ui container">
  4. <div class="repo-header">
  5. <div class="repo-title-wrap gt-df gt-fc">
  6. <div class="repo-title" role="heading" aria-level="1">
  7. {{$avatar := (repoAvatar . 32 "gt-mr-3")}}
  8. {{if $avatar}}
  9. {{$avatar}}
  10. {{else}}
  11. {{template "repo/icon" .}}
  12. {{end}}
  13. <a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>
  14. <div class="gt-mx-2">/</div>
  15. <a href="{{$.RepoLink}}">{{.Name}}</a>
  16. <div class="labels gt-df gt-ac gt-fw">
  17. {{if .IsTemplate}}
  18. {{if .IsPrivate}}
  19. <span class="ui basic label">{{$.locale.Tr "repo.desc.private_template"}}</span>
  20. {{else}}
  21. {{if .Owner.Visibility.IsPrivate}}
  22. <span class="ui basic label">{{$.locale.Tr "repo.desc.internal_template"}}</span>
  23. {{end}}
  24. {{end}}
  25. {{else}}
  26. {{if .IsPrivate}}
  27. <span class="ui basic label">{{$.locale.Tr "repo.desc.private"}}</span>
  28. {{else}}
  29. {{if .Owner.Visibility.IsPrivate}}
  30. <span class="ui basic label">{{$.locale.Tr "repo.desc.internal"}}</span>
  31. {{end}}
  32. {{end}}
  33. {{end}}
  34. {{if .IsArchived}}
  35. <span class="ui basic label">{{$.locale.Tr "repo.desc.archived"}}</span>
  36. {{end}}
  37. </div>
  38. {{if $.EnableFeed}}
  39. <a class="rss-icon gt-ml-3" href="{{$.RepoLink}}.rss" data-tooltip-content="{{$.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</a>
  40. {{end}}
  41. </div>
  42. {{if $.PullMirror}}
  43. {{$address := MirrorRemoteAddress $.Context . $.PullMirror.GetRemoteName false}}
  44. <div class="fork-flag">{{$.locale.Tr "repo.mirror_from"}} <a target="_blank" rel="noopener noreferrer" href="{{$address.Address}}">{{$address.Address}}</a></div>
  45. {{end}}
  46. {{if .IsFork}}<div class="fork-flag">{{$.locale.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{.BaseRepo.FullName}}</a></div>{{end}}
  47. {{if .IsGenerated}}<div class="fork-flag">{{$.locale.Tr "repo.generated_from"}} <a href="{{.TemplateRepo.Link}}">{{.TemplateRepo.FullName}}</a></div>{{end}}
  48. </div>
  49. {{if not (or .IsBeingCreated .IsBroken)}}
  50. <div class="repo-buttons">
  51. {{if $.RepoTransfer}}
  52. <form method="post" action="{{$.RepoLink}}/action/accept_transfer?redirect_to={{$.RepoLink}}">
  53. {{$.CsrfTokenHtml}}
  54. <div data-tooltip-content="{{if $.CanUserAcceptTransfer}}{{$.locale.Tr "repo.transfer.accept_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{$.locale.Tr "repo.transfer.no_permission_to_accept"}}{{end}}">
  55. <button type="submit" class="ui basic button {{if $.CanUserAcceptTransfer}}green {{end}} ok small"{{if not $.CanUserAcceptTransfer}} disabled{{end}}>
  56. {{$.locale.Tr "repo.transfer.accept"}}
  57. </button>
  58. </div>
  59. </form>
  60. <form method="post" action="{{$.RepoLink}}/action/reject_transfer?redirect_to={{$.RepoLink}}">
  61. {{$.CsrfTokenHtml}}
  62. <div data-tooltip-content="{{if $.CanUserAcceptTransfer}}{{$.locale.Tr "repo.transfer.reject_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{$.locale.Tr "repo.transfer.no_permission_to_reject"}}{{end}}">
  63. <button type="submit" class="ui basic button {{if $.CanUserAcceptTransfer}}red {{end}}ok small"{{if not $.CanUserAcceptTransfer}} disabled{{end}}>
  64. {{$.locale.Tr "repo.transfer.reject"}}
  65. </button>
  66. </div>
  67. </form>
  68. {{end}}
  69. <form method="post" action="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}">
  70. {{$.CsrfTokenHtml}}
  71. <div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{$.locale.Tr "repo.watch_guest_user"}}"{{end}}>
  72. <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}>
  73. {{if $.IsWatchingRepo}}{{svg "octicon-eye-closed" 16}}{{$.locale.Tr "repo.unwatch"}}{{else}}{{svg "octicon-eye"}}{{$.locale.Tr "repo.watch"}}{{end}}
  74. </button>
  75. <a class="ui basic label" href="{{.Link}}/watchers">
  76. {{CountFmt .NumWatches}}
  77. </a>
  78. </div>
  79. </form>
  80. {{if not $.DisableStars}}
  81. <form method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
  82. {{$.CsrfTokenHtml}}
  83. <div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{$.locale.Tr "repo.star_guest_user"}}"{{end}}>
  84. <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}>
  85. {{if $.IsStaringRepo}}{{svg "octicon-star-fill"}}{{$.locale.Tr "repo.unstar"}}{{else}}{{svg "octicon-star"}}{{$.locale.Tr "repo.star"}}{{end}}
  86. </button>
  87. <a class="ui basic label" href="{{.Link}}/stars">
  88. {{CountFmt .NumStars}}
  89. </a>
  90. </div>
  91. </form>
  92. {{end}}
  93. {{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}}
  94. <div class="ui labeled button
  95. {{if or (not $.IsSigned) (and (not $.CanSignedUserFork) (eq (len $.UserAndOrgForks) 0))}}
  96. disabled
  97. {{end}}"
  98. {{if not $.IsSigned}}
  99. data-tooltip-content="{{$.locale.Tr "repo.fork_guest_user"}}"
  100. {{else if and (not $.CanSignedUserFork) (eq (len $.UserAndOrgForks) 0)}}
  101. data-tooltip-content="{{$.locale.Tr "repo.fork_from_self"}}"
  102. {{end}}
  103. >
  104. <a class="ui compact{{if $.ShowForkModal}} show-modal{{end}} small basic button"
  105. {{if not $.CanSignedUserFork}}
  106. {{if gt (len $.UserAndOrgForks) 1}}
  107. data-modal="#fork-repo-modal"
  108. {{else if eq (len $.UserAndOrgForks) 1}}
  109. href="{{AppSubUrl}}/{{(index $.UserAndOrgForks 0).FullName}}"
  110. {{/*else is not required here, because the button shouldn't link to any site if you can't create a fork*/}}
  111. {{end}}
  112. {{else if eq (len $.UserAndOrgForks) 0}}
  113. href="{{AppSubUrl}}/repo/fork/{{.ID}}"
  114. {{else}}
  115. data-modal="#fork-repo-modal"
  116. {{end}}
  117. >
  118. {{svg "octicon-repo-forked"}}{{$.locale.Tr "repo.fork"}}
  119. </a>
  120. <div class="ui small modal" id="fork-repo-modal">
  121. <div class="header">
  122. {{$.locale.Tr "repo.already_forked" .Name}}
  123. </div>
  124. <div class="content gt-text-left">
  125. <div class="ui list">
  126. {{range $.UserAndOrgForks}}
  127. <div class="ui item gt-py-3">
  128. <a href="{{.Link}}">
  129. {{svg "octicon-repo-forked" 16 "gt-mr-3"}}{{.FullName}}
  130. </a>
  131. </div>
  132. {{end}}
  133. </div>
  134. {{if $.CanSignedUserFork}}
  135. <div class="ui divider"></div>
  136. <a href="{{AppSubUrl}}/repo/fork/{{.ID}}">
  137. {{$.locale.Tr "repo.fork_to_different_account"}}
  138. </a>
  139. {{end}}
  140. </div>
  141. </div>
  142. <a class="ui basic label" href="{{.Link}}/forks">
  143. {{CountFmt .NumForks}}
  144. </a>
  145. </div>
  146. {{end}}
  147. </div>
  148. {{end}}
  149. </div><!-- end grid -->
  150. </div><!-- end container -->
  151. {{end}}
  152. <div class="ui tabs container">
  153. {{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}}
  154. <div class="ui tabular menu navbar gt-overflow-x-auto gt-overflow-y-hidden">
  155. {{if .Permission.CanRead $.UnitTypeCode}}
  156. <a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL}}{{end}}">
  157. {{svg "octicon-code"}} {{.locale.Tr "repo.code"}}
  158. </a>
  159. {{end}}
  160. {{if .Permission.CanRead $.UnitTypeIssues}}
  161. <a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoLink}}/issues">
  162. {{svg "octicon-issue-opened"}} {{.locale.Tr "repo.issues"}}
  163. {{if .Repository.NumOpenIssues}}
  164. <span class="ui small label">{{CountFmt .Repository.NumOpenIssues}}</span>
  165. {{end}}
  166. </a>
  167. {{end}}
  168. {{if .Permission.CanRead $.UnitTypeExternalTracker}}
  169. <a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer">
  170. {{svg "octicon-link-external"}} {{.locale.Tr "repo.issues"}} </span>
  171. </a>
  172. {{end}}
  173. {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}}
  174. <a class="{{if .PageIsPullList}}active {{end}}item" href="{{.RepoLink}}/pulls">
  175. {{svg "octicon-git-pull-request"}} {{.locale.Tr "repo.pulls"}}
  176. {{if .Repository.NumOpenPulls}}
  177. <span class="ui small label">{{CountFmt .Repository.NumOpenPulls}}</span>
  178. {{end}}
  179. </a>
  180. {{end}}
  181. {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}}
  182. <a class="{{if .PageIsActions}}active {{end}}item" href="{{.RepoLink}}/actions">
  183. {{svg "octicon-play"}} {{.locale.Tr "actions.actions"}}
  184. {{if .Repository.NumOpenActionRuns}}
  185. <span class="ui small label">{{CountFmt .Repository.NumOpenActionRuns}}</span>
  186. {{end}}
  187. </a>
  188. {{end}}
  189. {{if .Permission.CanRead $.UnitTypePackages}}
  190. <a href="{{.RepoLink}}/packages" class="{{if .IsPackagesPage}}active {{end}}item">
  191. {{svg "octicon-package"}} {{.locale.Tr "packages.title"}}
  192. </a>
  193. {{end}}
  194. {{if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects)}}
  195. <a href="{{.RepoLink}}/projects" class="{{if .IsProjectsPage}}active {{end}}item">
  196. {{svg "octicon-project"}} {{.locale.Tr "repo.project_board"}}
  197. {{if .Repository.NumOpenProjects}}
  198. <span class="ui small label">{{CountFmt .Repository.NumOpenProjects}}</span>
  199. {{end}}
  200. </a>
  201. {{end}}
  202. {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo)}}
  203. <a class="{{if or .PageIsReleaseList .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/releases">
  204. {{svg "octicon-tag"}} {{.locale.Tr "repo.releases"}}
  205. {{if .NumReleases}}
  206. <span class="ui small label">{{CountFmt .NumReleases}}</span>
  207. {{end}}
  208. </a>
  209. {{end}}
  210. {{if .Permission.CanRead $.UnitTypeWiki}}
  211. <a class="{{if .PageIsWiki}}active {{end}}item" href="{{.RepoLink}}/wiki">
  212. {{svg "octicon-book"}} {{.locale.Tr "repo.wiki"}}
  213. </a>
  214. {{end}}
  215. {{if .Permission.CanRead $.UnitTypeExternalWiki}}
  216. <a class="item" href="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}" target="_blank" rel="noopener noreferrer">
  217. {{svg "octicon-link-external"}} {{.locale.Tr "repo.wiki"}}
  218. </a>
  219. {{end}}
  220. {{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsEmptyRepo)}}
  221. <a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity">
  222. {{svg "octicon-pulse"}} {{.locale.Tr "repo.activity"}}
  223. </a>
  224. {{end}}
  225. {{template "custom/extra_tabs" .}}
  226. {{if .Permission.IsAdmin}}
  227. <a class="{{if .PageIsRepoSettings}}active {{end}}right item" href="{{.RepoLink}}/settings">
  228. {{svg "octicon-tools"}} {{.locale.Tr "repo.settings"}}
  229. </a>
  230. {{end}}
  231. </div>
  232. {{else if .Permission.IsAdmin}}
  233. <div class="ui tabular menu navbar gt-overflow-x-auto gt-overflow-y-hidden">
  234. <a class="{{if .PageIsRepoSettings}}active {{end}}right item" href="{{.RepoLink}}/settings">
  235. {{svg "octicon-tools"}} {{.locale.Tr "repo.settings"}}
  236. </a>
  237. </div>
  238. {{end}}
  239. </div>
  240. <div class="ui tabs divider"></div>
  241. </div>