summaryrefslogtreecommitdiffstats
path: root/templates/repo
Commit message (Collapse)AuthorAgeFilesLines
* Refactor hiding-methods, remove jQuery show/hide, remove `.hide` class, ↵wxiaoguang2023-02-1939-72/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | remove inline style=display:none (#22950) Close #22847 This PR: * introduce Gitea's own `showElem` and related functions * remove jQuery show/hide * remove .hide class * remove inline style=display:none From now on: do not use: * "[hidden]" attribute: it's too weak, can not be applied to an element with "display: flex" * ".hidden" class: it has been polluted by Fomantic UI in many cases * inline style="display: none": it's difficult to tweak * jQuery's show/hide/toggle: it can not show/hide elements with "display: xxx !important" only use: * this ".gt-hidden" class * showElem/hideElem/toggleElem functions in "utils/dom.js" cc: @silverwind , this is the all-in-one PR
* Scoped labels (#22585)Brecht Van Lommel2023-02-189-66/+126
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new "exclusive" option per label. This makes it so that when the label is named `scope/name`, no other label with the same `scope/` prefix can be set on an issue. The scope is determined by the last occurence of `/`, so for example `scope/alpha/name` and `scope/beta/name` are considered to be in different scopes and can coexist. Exclusive scopes are not enforced by any database rules, however they are enforced when editing labels at the models level, automatically removing any existing labels in the same scope when either attaching a new label or replacing all labels. In menus use a circle instead of checkbox to indicate they function as radio buttons per scope. Issue filtering by label ensures that only a single scoped label is selected at a time. Clicking with alt key can be used to remove a scoped label, both when editing individual issues and batch editing. Label rendering refactor for consistency and code simplification: * Labels now consistently have the same shape, emojis and tooltips everywhere. This includes the label list and label assignment menus. * In label list, show description below label same as label menus. * Don't use exactly black/white text colors to look a bit nicer. * Simplify text color computation. There is no point computing luminance in linear color space, as this is a perceptual problem and sRGB is closer to perceptually linear. * Increase height of label assignment menus to show more labels. Showing only 3-4 labels at a time leads to a lot of scrolling. * Render all labels with a new RenderLabel template helper function. Label creation and editing in multiline modal menu: * Change label creation to open a modal menu like label editing. * Change menu layout to place name, description and colors on separate lines. * Don't color cancel button red in label editing modal menu. * Align text to the left in model menu for better readability and consistent with settings layout elsewhere. Custom exclusive scoped label rendering: * Display scoped label prefix and suffix with slightly darker and lighter background color respectively, and a slanted edge between them similar to the `/` symbol. * In menus exclusive labels are grouped with a divider line. --------- Co-authored-by: Yarden Shoham <hrsi88@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
* Introduce customized HTML elements, fix incorrect AppUrl usages in templates ↵wxiaoguang2023-02-172-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#22861) This PR follows: * #21986 * #22831 This PR also introduce customized HTML elements, which would also help problems like: * #17760 * #21429 * #21440 With customized HTML elements, there won't be any load-search-replace operations, and it can avoid page flicking (which @silverwind cares a lot). Browser support: https://developer.mozilla.org/en-US/docs/Web/API/Window/customElements # FAQ ## Why the component has the prefix? As usual, I would strongly suggest to add prefixes for our own/private names. The dedicated prefix will avoid conflicts in the future, and it makes it easier to introduce various 3rd components, like GitHub's `relative-time` component. If there is no prefix, it's impossible to introduce another public component with the same name in the future. ## Why the `custcomp.js` is loaded before HTML body? The `index.js` is after HTML body. Customized components must be registered before the content loading. Otherwise there would be still some flicking. `custcomp.js` should have its own dependencies and should be very light, so it won't affect the page loading time too much. ## Why use `data-url` attribute but not use the `textContent`? According to the standard, the `connectedCallback` occurs on the tag-opening moment. The element's children are not ready yet. ## Why not use `{{.GuessCurrentOrigin $.ctx ...}}` to let backend decide the absolute URL? It's difficult for backend to guess the correct protocol(scheme) correctly with zero configuration. Generating the absolute URL from frontend can guarantee that the URL is 100% correct -- since the user is visiting it. # Screenshot <details> ![image](https://user-images.githubusercontent.com/2114189/218256757-a267c8ba-3108-4755-9ae5-329f1b08f615.png) </details>
* Fix 404 error viewing the LFS file (#22945)Zettat1232023-02-171-1/+1
| | | | | | | | | Fix #22734. According to [`view_file.tmpl`](https://github.com/go-gitea/gitea/blob/main/templates/repo/view_file.tmpl#L82), `lfs_file.tmpl` should use `AssetUrlPrefix` instead of `AppSubUrl`. Co-authored-by: Jason Song <i@wolfogre.com>
* Always go full width in PR view (#22844)gempir2023-02-163-3/+3
| | | | | | | | | | | | This is an alternative solution to #22824 and would also close #22781 This makes the PR diff view always full width. It makes sense to make use of that screen real estate. If you want a more narrow view you can always resize your browser. It also avoids cluttering the UI with another button + the database with another column for the setting. This is also how github and gitlab do it.
* Fix context bug (#22940)Lunny Xiao2023-02-161-1/+1
| | | Fix https://try.gitea.io/wxiaoguang/test/issues/19
* First step to refactor the `.hide` to `.gt-hidden` (#22916)wxiaoguang2023-02-161-4/+4
| | | A separate PR from #22884 (without touching the jQuery methods)
* Fix shabox regression (#22924)Gusted2023-02-161-2/+2
| | | | | | | - Regression from https://github.com/go-gitea/gitea/pull/22294 Error: ![image](https://user-images.githubusercontent.com/25481501/219115669-52b98fdb-bcbb-430d-a205-beb305c37e85.png)
* Always show the `command line instructions` button even if there are ↵wxiaoguang2023-02-152-16/+18
| | | | | | conflicts (#22909) Always show the `command line instructions` button even if there are conflicts.
* Add context cache as a request level cache (#22294)Lunny Xiao2023-02-1533-112/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid duplicated load of the same data in an HTTP request, we can set a context cache to do that. i.e. Some pages may load a user from a database with the same id in different areas on the same page. But the code is hidden in two different deep logic. How should we share the user? As a result of this PR, now if both entry functions accept `context.Context` as the first parameter and we just need to refactor `GetUserByID` to reuse the user from the context cache. Then it will not be loaded twice on an HTTP request. But of course, sometimes we would like to reload an object from the database, that's why `RemoveContextData` is also exposed. The core context cache is here. It defines a new context ```go type cacheContext struct { ctx context.Context data map[any]map[any]any lock sync.RWMutex } var cacheContextKey = struct{}{} func WithCacheContext(ctx context.Context) context.Context { return context.WithValue(ctx, cacheContextKey, &cacheContext{ ctx: ctx, data: make(map[any]map[any]any), }) } ``` Then you can use the below 4 methods to read/write/del the data within the same context. ```go func GetContextData(ctx context.Context, tp, key any) any func SetContextData(ctx context.Context, tp, key, value any) func RemoveContextData(ctx context.Context, tp, key any) func GetWithContextCache[T any](ctx context.Context, cacheGroupKey string, cacheTargetID any, f func() (T, error)) (T, error) ``` Then let's take a look at how `system.GetString` implement it. ```go func GetSetting(ctx context.Context, key string) (string, error) { return cache.GetWithContextCache(ctx, contextCacheKey, key, func() (string, error) { return cache.GetString(genSettingCacheKey(key), func() (string, error) { res, err := GetSettingNoCache(ctx, key) if err != nil { return "", err } return res.SettingValue, nil }) }) } ``` First, it will check if context data include the setting object with the key. If not, it will query from the global cache which may be memory or a Redis cache. If not, it will get the object from the database. In the end, if the object gets from the global cache or database, it will be set into the context cache. An object stored in the context cache will only be destroyed after the context disappeared.
* Add tooltip to issue reference (#22913)delvh2023-02-151-2/+2
| | | | | | | | | | | | | | | Previously, you had no idea what you are copying with the issue reference button for either long repo names, user names, or issue indexes. Now, it is simply a bit redundant for short references but a lot easier for long references. ## Before ![image](https://user-images.githubusercontent.com/51889757/218995943-3b609ee9-4138-49ce-99b1-73fb1ea80280.png) ## After ![image](https://user-images.githubusercontent.com/51889757/218996119-4b6bf6c1-abfa-4618-81ca-a72914e73eb8.png)
* Remove Fomantic-UI's `.hidden` CSS class for menu elements (#22895)wxiaoguang2023-02-144-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Like #22851 * All other dropdown menu elements do not have such `hidden` class. * Actually the dropdown menu elements do not need it in HTML, so this PR removes it. * There is already `.ui.dropdown .menu { display: none; }`, so when loading the page, the menu is correctly hidden initially, no need to add any more CSS classes. * The Fomantic UI's `.hidden` class should still exist until there is no its checkbox/dropdown module anymore. The Fomantic UI JS code still addes `hidden` for `ui checkbox` and addes `transition hidden` for `ui menu` at the moment. * This PR also cleans the legacy inline `style`, which is quite hacky and no need anymore. All these dropdown menus work well. I have tested these 5 places: * The code search from User Profile * The issue sidebar to lock issue * The repo search form * The repo setting page: branch list * The repo setting page: merge option list Screenshot: ![image](https://user-images.githubusercontent.com/2114189/218534515-e7dfe291-6765-4e0b-833c-b74f17e30117.png)
* Move helpers to be prefixed with `gt-` (#22879)zeripath2023-02-1365-434/+434
| | | | | | | | | | | | | | | | | | | | As discussed in #22847 the helpers in helpers.less need to have a separate prefix as they are causing conflicts with fomantic styles This will allow us to have the `.gt-hidden { display:none !important; }` style that is needed to for the reverted PR. Of note in doing this I have noticed that there was already a conflict with at least one chroma style which this PR now avoids. I've also added in the `gt-hidden` style that matches the tailwind one and switched the code that needed it to use that. Signed-off-by: Andrew Thornton <art27@cantab.net> --------- Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Pull Requests: setting to allow edits by maintainers by default, tweak UI ↵Brecht Van Lommel2023-02-132-28/+40
| | | | | | | | | | | | | | | | | | (#22862) Add setting to allow edits by maintainers by default, to avoid having to often ask contributors to enable this. This also reorganizes the pull request settings UI to improve clarity. It was unclear which checkbox options were there to control available merge styles and which merge styles they correspond to. Now there is a "Merge Styles" label followed by the merge style options with the same name as in other menus. The remaining checkboxes were moved to the bottom, ordered rougly by typical order of operations. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Remove Fomantic-UI's `.hidden` CSS class for checkbox elements (#22851)wxiaoguang2023-02-135-38/+38
| | | | | | | | | | Fomantic-UI's `.hidden` CSS class is badly designed. * Checkbox elements do not need it in HTML, so this PR removes it (JS adds the `.hidden` class back by `$('.ui.checkbox').checkbox()`) * `menu transaction hidden` is still needed, and it should be the only usage for the `.hidden` from now on (until they get refactored properly) Co-authored-by: zeripath <art27@cantab.net>
* Add some headings to repo views (#22869)Felipe Leopoldo Sologuren Gutiérrez2023-02-122-3/+3
| | | | | | | | | | | | | | | * Add role heading level 1 to username/repo title. * Copy behaviour of Releases to some other views. Contributed by @Forgejo. ![Screenshot with h2](https://user-images.githubusercontent.com/5055343/218287363-dfae9ab2-7297-4367-ab64-ab141506e131.png) ![Screenshot with former div](https://user-images.githubusercontent.com/5055343/218287419-77d0ed56-935d-492f-b3ed-71051d169ba8.png) Co-authored-by: delvh <leon@kske.dev> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix milestone title font problem (#22863)wxiaoguang2023-02-121-2/+2
| | | | | | | | | | | | | | | | | | | | Replace #22853 since it's closed, and actually there are 2 places need to be fixed. ~~Follow @fsologureng 's suggestion to keep the `<hX>` tags.~~ Update: from fsologureng: this doesn't change anything from a11y's point of view. So I think this PR could be fine to fix the UI looking problems as a quick patch, then defer the a11y problems to new PRs together. Before: the font-size is too large. After: it seems better. ![image](https://user-images.githubusercontent.com/2114189/218266257-fc2d5872-9e96-4c6a-87ea-f27531ac15c0.png) ![image](https://user-images.githubusercontent.com/2114189/218266247-efc09d83-405f-4495-967a-30d9744134ce.png) Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Preview images for Issue cards in Project Board view (#22112)Nathaniel Sabanski2023-02-112-6/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Original Issue: https://github.com/go-gitea/gitea/issues/22102 This addition would be a big benefit for design and art teams using the issue tracking. The preview will be the latest "image type" attachments on an issue- simple, and allows for automatic updates of the cover image as issue progress is made! This would make Gitea competitive with Trello... wouldn't it be amazing to say goodbye to Atlassian products? Ha. First image is the most recent, the SQL will fetch up to 5 latest images (URL string). All images supported by browsers plus upcoming formats: *.avif *.bmp *.gif *.jpg *.jpeg *.jxl *.png *.svg *.webp The CSS will try to center-align images until it cannot, then it will left align with overflow hidden. Single images get to be slightly larger! Tested so far on: Chrome, Firefox, Android Chrome, Android Firefox. Current revision with light and dark themes: ![image](https://user-images.githubusercontent.com/24665/207066878-58e6bf73-0c93-4caa-8d40-38f4432b3578.png) ![image](https://user-images.githubusercontent.com/24665/207066555-293f65c3-e706-4888-8516-de8ec632d638.png) --------- Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* Make issue title edit buttons focusable and fix incorrect ajax requests (#22807)wxiaoguang2023-02-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace #19922 , which is stale since my last review: https://github.com/go-gitea/gitea/pull/19922#pullrequestreview-1003546506 and https://github.com/go-gitea/gitea/pull/19922#issuecomment-1153181546 Close #19769 Changes: 1. Use `<button>` instead of `<div>` for buttons 2. Prevent default event handler in `initGlobalButtonClickOnEnter` 3. Fix the incorrect call to `pullrequest_targetbranch_change` 4. Add a slight margin-left to the input element to make UI look better The logic in repo-issue.js is not ideal, but this PR isn't going to touch the logic. This is also an example for future developers to understand how to make buttons work properly. ### Before ![image](https://user-images.githubusercontent.com/2114189/217262515-ec0462f7-7051-46a5-bfa2-2f6c6a807b7d.png) ### After * Add a slight margin-left. * The `Cancel` button is focused. ![image](https://user-images.githubusercontent.com/2114189/217264891-934c9c8d-d190-4866-98b5-666cea57e28d.png) Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Fix inconsistent Filter Project name in issue list (#22827)Brecht Van Lommel2023-02-091-2/+2
| | | Use Project instead of Filter Project like the other filter menus.
* Fix more HTMLURL in templates (#22831)wxiaoguang2023-02-094-73/+73
| | | | | | | | | | | | | | | I haven't tested `runs_list.tmpl` but I think it could be right. After this PR, besides the `<meta .. HTMLURL>` in html head, the only explicit HTMLURL usage is in `pull_merge_instruction.tmpl`, which doesn't affect users too much and it's difficult to fix at the moment. There are still many usages of `AppUrl` in the templates (eg: the package help manual), they are similar problems as the HTMLURL in pull_merge_instruction, and they might be fixed together in the future. Diff without space: https://github.com/go-gitea/gitea/pull/22831/files?diff=unified&w=1
* Fix unmatched div in project filter (#22832)John Olheiser2023-02-091-1/+0
| | | | | | | | | | | | | | | (Note that the below screenshots aren't the same repo, the former is try and the latter is local) Before ![div-before](https://user-images.githubusercontent.com/42128690/217723899-a15da77f-a196-4b23-a157-e7f1e1979610.png) After ![div-after](https://user-images.githubusercontent.com/42128690/217723878-e54235bc-a7d7-425e-bd0d-47d1814f18ba.png) Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Make clone URL use current page's host (#22808)wxiaoguang2023-02-091-1/+8
| | | | | | | | | | Follow #21986 Even if the ROOT_URL is incorrect, the clone URL on the UI should be correct. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix links for the menus in the view file page (#22795)wxiaoguang2023-02-081-2/+1
|
* Use link in UI which returned a relative url but not html_url which contains ↵Lunny Xiao2023-02-0615-32/+33
| | | | | | | | | | | | | | | an absolute url (#21986) partially fix #19345 This PR add some `Link` methods for different objects. The `Link` methods are not different from `HTMLURL`, they are lack of the absolute URL. And most of UI `HTMLURL` have been replaced to `Link` so that users can visit them from a different domain or IP. This PR also introduces a new javascript configuration `window.config.reqAppUrl` which is different from `appUrl` which is still an absolute url but the domain has been replaced to the current requested domain.
* Show all projects, not just repo projects and open/closed projects (#22640)Lunny Xiao2023-02-041-11/+53
| | | | | | | | | | | | | | | | | This PR fixes two problems. One is when filter repository issues, only repository level projects are listed. Another is if you list open issues, only open projects will be displayed in filter options and if you list closed issues, only closed projects will be displayed in filter options. In this PR, both repository level and org/user level projects will be displayed in filter, and both open and closed projects will be listed as filter items. --------- Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: delvh <dev.lh@web.de>
* Remove 'primary' class from tab counter labels (#22687)Francesco Siddi2023-02-031-5/+5
| | | | | | | | | Using the primary color for each label counter makes the use of color redundant, as well as suggesting this is a call to action. Use the base grey color instead. ![grey_lables](https://user-images.githubusercontent.com/451841/215778889-0d5dddad-353f-4703-a48f-1540080dee26.jpg)
* Update button is shown when a Pull Request is marked WIP - Issue #21740 (#22683)jladbrook2023-02-032-38/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix #21740. Updated the Pull Request template so that the 'Update branch by merge' button is visible for WIP PR's. Making the behaviour match a non WIP-PR. Previous WIP page with changes pending on the branch: ![image](https://user-images.githubusercontent.com/1656302/215738307-e68a2f92-5ff8-4f48-a541-35ca81d1f1a4.png) Updated UI adding the update button: ![image](https://user-images.githubusercontent.com/1656302/215737872-e0e9d712-b7aa-4b90-b7ed-6a92a14fc182.png) ## Notes * have not removed the **$canAutoMerge** variable from the pull.tmpl on this [line](https://github.com/go-gitea/gitea/blob/36dc11869d0401b796a7a3f74627fec842a4a89a/templates/repo/issue/view_content/pull.tmpl#L131) - doesn't appear to be used elsewhere but wasn't sure * In order to avoid duplicating code corresponding UI code was added to a new tmpl file, ```update_branch_by_merge.tmpl``` and is called in two places from ```pull.tmpl```. --------- Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix diff UI for unexpandable items (#22700)wxiaoguang2023-02-021-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follows #21094 Before: There are 2 problems: 1. Sometimes, the header starts with a number, sometimes, it starts with an icon button. It makes the UI look like misaligned. 2. The second item's bottom border is too thick (actually, that's an empty element with border, which should be hidden as well) 3. (An old problem) the number is not mono-font ![image](https://user-images.githubusercontent.com/2114189/215935944-003fe2d3-69bf-413c-bbae-0a4668a508c3.png) After: Fix above problems. ![image](https://user-images.githubusercontent.com/2114189/215944811-b867a20c-110c-47a2-aa52-572a8162a44d.png) --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: John Olheiser <john.olheiser@gmail.com>
* Add main landmark to templates and adjust titles (#22670)Felipe Leopoldo Sologuren Gutiérrez2023-02-0165-65/+65
| | | | | | | * Add main aria landmark to templates * Adjust some titles to improve understanding of location in navigation Contributed by @Forgejo
* Add user secrets (#22191)KN4CK3R2023-02-014-83/+15
| | | | | | | | | | | | Fixes #22183 Replaces #22187 This PR adds secrets for users. I refactored the files for organizations and repos to use the same logic and templates. I splitted the secrets from deploy keys again and reverted the fix from #22187. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Improve checkbox accessibility a bit by adding the title attribute (#22593)Felipe Leopoldo Sologuren Gutiérrez2023-02-012-3/+2
| | | | | | | EDIT: The main change of this PR was resolved by #22599. This complements that PR for some cases without label and complicated layout to be added. NOTE: Contributed by @Forgejo.
* Add repository setting to enable/disable releases unit (#22671)Brecht Van Lommel2023-02-011-0/+13
| | | | To go along with similar settings for issues, pulls, projects, packages.
* Fix ref to trigger Actions (#22679)Jason Song2023-01-311-1/+8
| | | | | | | | | | | | | | If triggered by PR, the ref should be `pull/<index>/head` instead of `repo.DefaultBranch`. And improve UI: <img width="493" alt="image" src="https://user-images.githubusercontent.com/9418365/215731280-312564f2-2450-45d0-b986-1accb0670976.png"> Related to #21937.
* Fix missing title and filter in issue sidebar project menu (#22557)Brecht Van Lommel2023-01-311-0/+7
| | | These exist in the new issue form but were seemingly forgotten here.
* Hide collapse icon in diff with no lines (#21094)JakobDev2023-01-311-7/+9
| | | | Sometimes (e.g. renaming a file) nothing of the content is changed. In this case, it makes no sense to show the collapse icon in a diff.
* Fixes accessibility behavior of Watching, Staring and Fork buttons (#22634)Felipe Leopoldo Sologuren Gutiérrez2023-01-311-3/+3
| | | Add tabindex to buttons of repository views.
* Implement actions (#21937)Jason Song2023-01-3110-0/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Issues: add Project filter to issues list and search (#22544)techknowlogick2023-01-293-22/+41
| | | | | | | | | | | | Currently only a single project like milestone, not multiple like labels. Implements #14298 Code by @brechtvl --------- Co-authored-by: Brecht Van Lommel <brecht@blender.org>
* Fixes accessibility of empty repository commit status (#22632)Felipe Leopoldo Sologuren Gutiérrez2023-01-281-1/+1
| | | | | | | | | | | | | | | | | | Avoid empty labelled anchor in repo without commits. Contributed by @forgejo. <!-- Please check the following: 1. Make sure you are targeting the `main` branch, pull requests on release branches are only allowed for bug fixes. 2. Read contributing guidelines: https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md 3. Describe what your pull request does and which issue you're targeting (if any) -->
* Add templates to customize text when creating and migrating repositoriesBrecht Van Lommel2023-01-244-4/+5
| | | | | These can be used to explain which types of repositories a Gitea instance is willing to host, or other rules for creating repositories.
* Support org/user level projects (#22235)Lunny Xiao2023-01-201-6/+6
| | | | | | | | Fix #13405 <img width="1151" alt="image" src="https://user-images.githubusercontent.com/81045/209442911-7baa3924-c389-47b6-b63b-a740803e640e.png"> Co-authored-by: 6543 <6543@obermui.de>
* Mute all links in issue timeline (#22533)silverwind2023-01-201-49/+49
| | | | | | | | | | | | | | | | https://github.com/go-gitea/gitea/pull/21799 introduced a regression where some links in the issue timeline were not muted any more. Fix it by replacing all `class="text grey"` with `class="text grey muted-links"` in the file. Before: <img width="384" alt="Screenshot 2023-01-19 at 22 23 05" src="https://user-images.githubusercontent.com/115237/213565351-1bb82f4e-fa72-4cd7-8e36-e527bbfe5c5f.png"> After: <img width="377" alt="Screenshot 2023-01-19 at 22 23 11" src="https://user-images.githubusercontent.com/115237/213565359-87e14855-6599-472a-be0b-61297b168f9a.png"> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Supports wildcard protected branch (#20825)Lunny Xiao2023-01-163-54/+62
| | | | | | | | | | | | | | | | | This PR introduce glob match for protected branch name. The separator is `/` and you can use `*` matching non-separator chars and use `**` across separator. It also supports input an exist or non-exist branch name as matching condition and branch name condition has high priority than glob rule. Should fix #2529 and #15705 screenshots <img width="1160" alt="image" src="https://user-images.githubusercontent.com/81045/205651179-ebb5492a-4ade-4bb4-a13c-965e8c927063.png"> Co-authored-by: zeripath <art27@cantab.net>
* Restore function to "Show more" buttons (#22399)zeripath2023-01-131-1/+1
| | | | | | | | | | | | | | | There was a serious regression in #21012 which broke the Show More button on the diff page, and the show more button was also broken on the file tree too. This PR fixes this by resetting the pageData.diffFiles as the vue watched value and reattachs a function to the show more button outside of the file tree view. Fix #22380 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix due date rendering the wrong date in issue (#22302)Yarden Shoham2023-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | Previously, the last minute of the chosen date caused bad timezone rendering. For example, I chose January 4th, 2023. ### Before ```html <time data-format="date" datetime="Wed, 04 Jan 2023 23:59:59 +0000">January 5, 2023</time> ``` ### After ```html <time data-format="date" datetime="2023-01-04">January 4, 2023</time> ``` --- Closes #21999 Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
* Support template for merge message description (#22248)Jason Song2022-12-291-2/+3
| | | | | | | | | | | | | | | | | Fix #21435. Use the first line of the template as the git commit message title, and the rest as the description. ## Snapshots <img width="806" alt="image" src="https://user-images.githubusercontent.com/9418365/209644083-5d85179c-cf58-404f-bc98-c662398a2411.png"> <img width="860" alt="image" src="https://user-images.githubusercontent.com/9418365/209644392-22573090-e2c1-458b-ba44-855b79735632.png"> <img width="1154" alt="image" src="https://user-images.githubusercontent.com/9418365/209644457-a1b2711a-6787-45b4-b52c-a88d7fc132d7.png"> Co-authored-by: delvh <dev.lh@web.de>
* Add option to prohibit fork if user reached maximum limit of repositories ↵Xinyu Zhou2022-12-271-1/+1
| | | | | | | | | | | | | | | | | | (#21848) If user has reached the maximum limit of repositories: - Before - disallow create - allow fork without limit - This patch: - disallow create - disallow fork - Add option `ALLOW_FORK_WITHOUT_MAXIMUM_LIMIT` (Default **true**) : enable this allow user fork repositories without maximum number limit fixed https://github.com/go-gitea/gitea/issues/21847 Signed-off-by: Xinyu Zhou <i@sourcehut.net>
* Add Feed for Releases and Tags (#21696)Reo2022-12-211-0/+3
| | | | | | | | | Fixes #19091 Add Feed for Releases and Tags, can be accessed through `reponame/releases.rss`, `reponame/releases.atom`, `reponame/tags.rss`, and `reponame/tags.atom` Signed-off-by: Reo <reo_999@proton.me>
* Fix delete secret modal (#22187)Lunny Xiao2022-12-202-3/+23
| | | Fix #22181