1926 Commits

Author SHA1 Message Date
Nicolas
afcd11c77f BUG: Fix workflow run jobs API returning null steps (#36603)
## Problem

`GET /api/v1/repos/{owner}/{repo}/actions/runs/{runId}/jobs` was always
returning `steps: null` for each job.

## Cause

In `convert.ToActionWorkflowJob`, when the job had a `TaskID` we loaded
the task with `db.GetByID` but never loaded `task.Steps`.
`ActionTask.Steps` is not stored in the task row (`xorm:"-"`); it comes
from `action_task_step` and is only filled by `task.LoadAttributes()` /
`GetTaskStepsByTaskID()`. So the conversion loop over `task.Steps`
always saw nil and produced no steps in the API response.

## Solution

After resolving the task (by ID when the caller passes `nil`), we now
load its steps with `GetTaskStepsByTaskID(ctx, task.ID)` and set
`task.Steps` before building the API steps slice. No other behavior is
changed.

## Testing

- New integration test `TestAPIListWorkflowRunJobsReturnsSteps`: calls
the runs/{runId}/jobs endpoint, inserts a task step for a fixture job,
and asserts that the response includes non-null, non-empty `steps` with
the expected step data.
- `make test-sqlite#TestAPIListWorkflowRunJobsReturnsSteps` passes with
this fix.

---------

Co-authored-by: Manav <mdave0905@gmail.com>
2026-02-13 08:16:43 +00:00
wxiaoguang
0d8bd7720d Refactor highlight and diff (#36599)
1. fix a performance regression when using line-by-line highlighting
* the root cause is that chroma's `lexers.Get` is slow and a lexer cache
is missing during recent changes
2. clarify the chroma lexer detection behavior
* now we fully manage our logic to detect lexer, and handle overriding
problems, everything is fully under control
3. clarify "code analyze" behavior, now only 2 usages:
* only use file name and language to detect lexer (very fast), mainly
for "diff" page which contains a lot of files
* if no lexer is detected by file name and language, use code content to
detect again (slow), mainly for "view file" or "blame" page, which can
get best result
4. fix git diff bug, it caused "broken pipe" error for large diff files
2026-02-13 00:15:46 +00:00
Lunny Xiao
d69b786097 Fix bug when do LFS GC (#36500)
Fix #36448

Removed unnecessary parameters from the LFS GC process and switched to
an ORDER BY id ASC strategy with a last-ID cursor to avoid missing or
duplicating meta object IDs.

---------

Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-12 15:27:19 -08:00
wxiaoguang
2876800cb2 Fine tune diff highlighting (#36592) 2026-02-12 07:01:36 +00:00
silverwind
45ee571693 Update to go 1.26.0 and golangci-lint 2.9.0 (#36588) 2026-02-11 18:37:13 +01:00
wxiaoguang
3754e9dd12 Improve diff highlighting (#36583) 2026-02-11 03:52:17 +00:00
Lunny Xiao
18ccee0f2f Fix mirror sync parser and fix mirror messages (#36504)
Fix #36474 

It also fixed a bug when sync deleted branches.
2026-02-11 00:16:05 +00:00
wxiaoguang
8cc8150922 Use full-file highlighting for diff sections (#36561)
* Fix #35252
* Fix #35999
* Improve diff rendering, don't add unnecessary "added"/"removed" tags for a full-line change
* Also fix a "space trimming" bug in #36539 and add tests
* Use chroma "SQL" lexer instead of "MySQL" to workaround a bug (35999)
2026-02-10 03:29:28 +00:00
Sebastian Ertz
36ced5dc8c Enable pagination on GiteaDownloader.getIssueReactions() (#36549)
And update code.gitea.io/sdk/gitea to v0.23.2

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2026-02-09 15:49:05 +01:00
ChristopherHX
34b34d2328 Refactor merge conan and container auth preserve actions taskID (#36560)
* Remove duplicated code
* Allow further ActionsUser package permission checks

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-02-09 03:04:56 +00:00
wxiaoguang
2ff4f4a909 Fix highlight diff result (#36539)
Fix #36536

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
2026-02-08 16:48:52 +00:00
ChristopherHX
f65df2a69b Refactor Nuget Auth to reuse Basic Auth Token Validation (#36558)
* Implicitly handle Actions Task Token for Nuget Api Keys
* Support same tokens as Basic Auth in Nuget Api Key Header

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-02-08 14:43:05 +00:00
Louis
e2104a1dd5 Allow configuring default PR base branch (fixes #36412) (#36425)
This adds a per-repository default PR base branch and wires it through
PR entry points. It updates compare links and recently pushed branch
prompts to respect the configured base branch, and prevents auto-merge
cleanup from deleting the configured base branch on same-repo PRs.

## Behavior changes
- New PR compare links on repo home/issue list and branch list honor the
configured default PR base branch.
- The "recently pushed new branches" prompt now compares against the
configured base branch.
- Auto-merge branch cleanup skips deleting the configured base branch
(same-repo PRs only).

---------

Signed-off-by: Louis <116039387+tototomate123@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-02-07 01:34:29 +00:00
Noel Jackson
65d93d819b fix(packages/container): data race when uploading container blobs concurrently (#36524)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-02-04 00:08:20 +08:00
Nicolas
c2dea22926 Add resolve/unresolve review comment API endpoints (#36441)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-02-01 12:28:28 +00:00
Copilot
072de7d8cd Unify repo names in system notices (#36491)
Fixes: https://github.com/go-gitea/gitea/issues/36211

This PR fixes ensures that all system notices consistently include
repository names in the format `"Action description (owner/repo): error
message"`.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: silverwind <115237+silverwind@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-02-01 17:06:57 +08:00
wxiaoguang
7ad9bf4523 Refactor ActionsTaskID (#36503) 2026-01-31 22:01:08 -08:00
Copilot
8feabe4160 Add FOLDER_ICON_THEME configuration option (#36496)
Fixes: https://github.com/go-gitea/gitea/issues/35182
Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: silverwind <115237+silverwind@users.noreply.github.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-01-30 20:48:56 +00:00
silverwind
a16ca3c57c Don't create self-references in merged PRs (#36490)
Fixes: https://github.com/go-gitea/gitea/issues/36488
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2026-01-30 20:12:24 +00:00
Lunny Xiao
208cbd5a6f Fix bug when list pull request commits (#36485)
Fix #36483 

In git log/rev-list, the "..." syntax represents the symmetric
difference between two references, which is different from the meaning
of "..." in git diff (where it implies diffing from the merge base).

For listing PR commits, we must use `merge-base..head` to include only
the commits introduced by the head branch. Otherwise, commits newly
pushed to the base branch would also be included, which is incorrect.
2026-01-30 18:46:34 +00:00
wxiaoguang
07ada3666b chore: add comments for "api/healthz", clean up test env (#36481)
GITEA_UNIT_TESTS_LOG_SQL is renamed to GITEA_TEST_LOG_SQL
2026-01-30 10:23:38 +08:00
Lunny Xiao
1463426a27 Use merge tree to detect conflicts when possible (#36400)
In Git 2.38, the `merge-tree` command introduced the `--write-tree`
option, which works directly on bare repositories. In Git 2.40, a new parameter `--merge-base` introduced so we require Git 2.40 to use the merge tree feature.

This option produces the merged tree object ID, allowing us to perform
diffs between commits without creating a temporary repository. By
avoiding the overhead of setting up and tearing down temporary repos,
this approach delivers a notable performance improvement.

It also fixes a possible situation that conflict files might be empty
but it's a conflict status according to
https://git-scm.com/docs/git-merge-tree#_mistakes_to_avoid

Replace #35542

---------

Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-27 11:57:20 -08:00
wxiaoguang
4c8f6dfa4e Support rendering OpenAPI spec (#36449)
Fix #20852
2026-01-26 10:34:38 +08:00
Moritz Jörg
89bfddc5c2 Normalize guessed languages for code highlighting (#36450)
For when Enry correctly recognized the language, but returns the
language name in a way that isn't recognized by chroma.

Resolves https://github.com/go-gitea/gitea/issues/22443

---------

Co-authored-by: Moritz Jörg <moritz.jorg@oceanbox.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-25 14:02:16 +00:00
lif
4ed43c2a32 fix: Improve image captcha contrast for dark mode (#36265)
## Summary
This PR fixes #36255

The image captcha was using random colors which often resulted in poor
contrast against dark backgrounds, making it difficult or impossible for
users to read in dark mode.

## Changes
- Added a custom color palette to the image captcha configuration in
`services/context/captcha.go`
- The palette uses high-contrast colors (bright red, blue, green,
yellow, purple, and dark blue-gray) that provide good visibility in both
light and dark themes
- This improves accessibility and user experience without changing any
existing functionality

## Testing
- Builds successfully
- All existing tests pass
- The color palette is properly supported by the upstream
`gitea.com/go-chi/captcha` library

---
Generated with Claude Code

---------

Signed-off-by: majiayu000 <1835304752@qq.com>
Co-authored-by: silverwind <me@silverwind.io>
2026-01-24 05:41:51 +00:00
wxiaoguang
9de659437e Refactor template render (#36438) 2026-01-24 05:11:49 +00:00
Zettat123
52c3a7d3ce Bugfix: Potential incorrect runID in run status update (#36437)
`jobs[0]` may not belong to the run for `runID`.

Co-authored-by: Giteabot <teabot@gitea.io>
2026-01-23 11:11:56 +00:00
Kemal Zebari
56c5d5e819 Restrict branch naming when new change matches with protection rules (#36405)
Resolves #36381 by only allowing admins to perform branch renames that
match to branch protection rules.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2026-01-23 11:42:24 +01:00
wxiaoguang
e42a1dbb6b Refactor GetRepoRawDiffForFile to avoid unnecessary pipe or goroutine (#36434) 2026-01-23 02:10:11 +00:00
wxiaoguang
3a09d7aa8d Refactor git command stdio pipe (#36422)
Most potential deadlock problems should have been fixed, and new code is
unlikely to cause new problems with the new design.

Also raise the minimum Git version required to 2.6.0 (released in 2015)
2026-01-22 06:04:26 +00:00
wxiaoguang
9ea91e036f Refactor git command context & pipeline (#36406)
Less and simpler code, fewer bugs
2026-01-21 01:35:14 +00:00
Lunny Xiao
f6db180a80 Fix missing repository id when migrating release attachments (#36389)
This PR fixes missed repo_id on the migration of attachments to Gitea.
It also provides a doctor check to fix the dirty data on the database.
2026-01-20 10:05:51 -08:00
wxiaoguang
72be55f7d3 Refactor git command stderr handling (#36402)
And clean up legacy fragile & incorrect logic
2026-01-18 15:10:33 -08:00
Lunny Xiao
fafd1db19e Some refactors about GetMergeBase (#36186)
Maybe fix #32018

- Use `gitrepo.GetMergeBase` method instead of other two
implementations.
- Add `FetchRemoteCommit` so that we don't need to add many `remote` to
the git repository to avoid possible git lock conflicts. A lock will
start when invoke the function, it will be invoked when cross-repository
comparing. The head repository will fetch the base repository's base
commit id. In most situations, it should lock the fork repositories so
that it should not become a bottleneck.
- Improve `GetCompareInfo` to remove unnecessarily adding remote.
- Remove unnecessary parameters of `SignMerge`.
2026-01-17 11:22:09 -08:00
yy
7a2aac406d fix: typos in comments (#36394) 2026-01-17 17:03:25 +00:00
Gregorius Bima Kharisma Wicaksana
65422fde4d Fix CODEOWNERS review request attribution using comment metadata (#36348)
Fixes #36333

## Problem

When CODEOWNERS automatically assigns reviewers to a pull request, the
timeline incorrectly shows the PR author as the one who requested the
review (e.g., "PR_AUTHOR requested review from CODE_OWNER"). This is
misleading since the action was triggered automatically by CODEOWNERS
rules, not by the PR author.

## Solution

Store CODEOWNERS attribution in comment metadata instead of changing the
doer user:
- Add `SpecialDoerName` field to `CommentMetaData` struct (value:
`"CODEOWNERS"` for CODEOWNERS-triggered requests)
- Pass `isCodeOwners=true` to `AddReviewRequest` and
`AddTeamReviewRequest` functions
- Template can check this metadata to show appropriate attribution
message

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-16 14:52:57 +00:00
TheFox0x7
69c5921d71 Add ability to download subpath archive (#36371)
closes: https://github.com/go-gitea/gitea/issues/4478

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-16 09:31:12 +00:00
Lunny Xiao
67e75f30a8 Fix bug on notification read (#36339)
When a user has been revoked permission to access a repository, the
related notification could still be visited. But the repository's
information should not be leaked any more.
2026-01-15 21:11:13 -08:00
Zeno
3f46de8265 Add chunked transfer encoding support for LFS uploads (#36380)
Enable chunked transfer encoding for Git LFS uploads by adding
Transfer-Encoding: chunked header to upload action responses. This
prevents large file uploads (100+ MB) from being blocked by reverse
proxies like Cloudflare that buffer non-chunked requests.

Fix https://github.com/go-gitea/gitea/issues/22233

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-16 07:15:18 +08:00
Lunny Xiao
14e8c9b767 Release attachments must belong to the intended repo (#36347) 2026-01-14 11:37:53 -08:00
Lunny Xiao
07ac29da32 Fix bug when compare in the pull request (#36363)
The pull request comparison should not use `direct compare`.
2026-01-14 16:56:23 +00:00
Lunny Xiao
8a98ac2213 clean watches when make a repository private and check permission when send release emails (#36319) 2026-01-14 16:11:22 +00:00
Lunny Xiao
95ea2df00a Add more check for stopwatch read or list (#36340) 2026-01-13 13:13:39 +00:00
TheFox0x7
040fc93046 fill missing has_code in repository api (#36338)
fixes: https://github.com/go-gitea/gitea/issues/36332

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2026-01-12 22:52:44 +00:00
wxiaoguang
7a23e247e6 Fix notifications pagination query parameters (#36351)
Fix #36350
2026-01-12 22:17:42 +00:00
silverwind
1d399bb1d1 Improve diff file headers (#36215)
- reduce file name font size from 15px to 14px
- fix labels and buttons being cut off when their size is constrained
- change labels from monospace to sans-serif font
- move diff stats to right and change them from sum of changes to +/-
- change filemode to label and change text to match other labels

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-12 20:29:35 +08:00
Lunny Xiao
da036f3f35 LFS locks must belong to the intended repo (#36344) 2026-01-11 12:57:58 +02:00
wxiaoguang
eec8ee056c Fix some trivial problems (#36336)
1. correctly parse git protocol's "OldCommit NewCommit RefName" line, it
should be explicitly split by space
2. add missing "return" in CreatePullRequest
3. add comments for "/user.keys" and "/user.gpg" outputs
4. trim space for the "commit status context name" to follow the same
behavior of git_model.NewCommitStatus
2026-01-09 20:58:21 +02:00
wxiaoguang
f6d3c70818 Fix diff view style handling (#36324)
Fix #36323
2026-01-09 04:37:16 +00:00
wxiaoguang
e226720cff Refactor cat-file batch operations and support --batch-command approach (#35775)
Replace #34651 and address more problems including fix framework bugs and changing to QueryInfo and QueryContent calls.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-01-08 13:37:36 -08:00