Commit Graph

1797 Commits

Author SHA1 Message Date
ChristopherHX
2401812b76 Cleanup ActionRun creation (#35624)
Closes #35622

---------

Signed-off-by: ChristopherHX <christopher.homberger@web.de>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-12 12:23:37 +00:00
Lunny Xiao
662a44d924 Fix merge panic (#35606)
To prevent potential bugs, the logic in #35543 makes `gitcmd.Command`
panic when attempting to override stdout or stderr. Instead of using
`PrepareCmd`, this PR now uses the WithXXX methods directly to avoid the
panic.

Fix #35603
2025-10-12 04:24:00 +02:00
ChristopherHX
25c4eb1659 Refactor ActionRunJob parsing into a reusable function (#35623)
Use a helper method around the jobparser for parsing a single job
structure from an ActionRunJob

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-11 12:58:36 -07:00
Zettat123
40f71bcd4c Support Actions concurrency syntax (#32751)
Fix #24769
Fix #32662
Fix #33260

Depends on https://gitea.com/gitea/act/pulls/124

-
https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency

## ⚠️ BREAKING ⚠️

This PR removes the auto-cancellation feature added by #25716. Users
need to manually add `concurrency` to workflows to control concurrent
workflows or jobs.

---------

Signed-off-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-10 18:58:55 +00:00
Lunny Xiao
69f5ee970c Move some functions to gitrepo package (#35543)
Refactor Git command functions to use WithXXX methods instead of
exposing RunOpts.
This change simplifies reuse across gitrepo and improves consistency,
encapsulation, and maintainability of command options.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-07 17:06:51 +08:00
Rob Gonnella
c9e7fde8b3 feat: adds option to force update new branch in contents routes (#35592)
Allows users to specify a "force" option in API /contents routes when
modifying files in a new branch. When "force" is true, and the branch
already exists, a force push will occur provided the branch does not
have a branch protection rule that disables force pushing.

This is useful as a way to manage a branch remotely through only the
API. For example in an automated release tool you can pull commits,
analyze, and update a release PR branch all remotely without needing to
clone or perform any local git operations.

Resolve #35538

---------

Co-authored-by: Rob Gonnella <rob.gonnella@papayapay.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-06 21:23:14 -07:00
Lunny Xiao
ad2ff67343 Move archive function to repo_model and gitrepo (#35514) 2025-10-06 15:01:26 -07:00
Zettat123
cdc0733047 Use inputs context when parsing workflows (#35590)
Depends on [gitea/act#143](https://gitea.com/gitea/act/pulls/143)

The [`inputs`
context](https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#inputs-context)
is used when parsing workflows so that `run-name` like `run-name: Deploy
to ${{ inputs.deploy_target }}` can be parsed correctly.
2025-10-06 06:09:27 +02:00
Lunny Xiao
e1c2fef593 Fix creating pull request failure when the target branch name is the same as some tag (#35552)
Use full reference name in the git command to avoid ambiguity.

Fix #35470
2025-10-03 22:54:37 +00:00
Lunny Xiao
17c8aa6587 Add rebase push display wrong comments bug (#35560)
Fix #35518

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-03 15:16:17 -07:00
wxiaoguang
71360a94cb Address some CodeQL security concerns (#35572)
Although there is no real security problem
2025-10-04 01:21:26 +08:00
Kausthubh J Rao
c4532101a4 fix(webhook): prevent tag events from bypassing branch filters targets #35449 (#35567)
Tag creation/deletion was triggering push webhooks even when branch
filters were configured, causing unintended pipeline executions.

This change modifies the branch filter logic to check the full ref
name directly instead of first determining if it's a "branch" event.

Fixes: Tag events now properly respect branch filters
- Add getPayloadRef() function to extract full ref names
- Update PrepareWebhook() to use direct ref matching
- Prevents refs/tags/* from matching refs/heads/* filters

Closes #35449

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2025-10-03 08:51:57 +02:00
Aleksandr Denisovich
efc48c36ff Added button to copy file name in PR files (#35509)
The merge request file viewer has a button for copying the file path,
but it is not always convenient. Often, you only want to copy the file
name, which is currently not possible. This change request adds this
capability.

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: a.kiselev <a.kiselev@reglab.ru>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-02 18:08:11 +00:00
junoberryferry
151ef80e28 use experimental go json v2 library (#35392)
details: https://pkg.go.dev/encoding/json/v2

---------

Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-09-28 08:03:36 +00:00
Lunny Xiao
8106d95577 Use global lock instead of status pool for cron lock (#35507) 2025-09-27 10:11:52 -07:00
Lunny Xiao
1f32170060 Move some functions to gitrepo package (#35503) 2025-09-26 10:14:20 -07:00
Lunny Xiao
7bf2972379 Move GetDiverging functions to gitrepo (#35524)
Extracted from #35469

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-09-26 15:15:42 +00:00
Sumit
f09bea7af1 [Fix] Trigger 'unlabeled' event when label is Deleted from PR (#34316)
This pull request updates the handling of issue label events in
workflows to distinguish between label additions and deletions,
introduces corresponding test cases, and extends the `IssuePayload`
structure to support this functionality.

### Enhancements to issue label event handling:
* Updated `matchIssuesEvent` in `modules/actions/workflows.go` to
differentiate between "labeled" and "unlabeled" events based on whether
labels were added or removed.
* Added a new field, `RemovedLabels`, to the `IssuePayload` struct in
`modules/structs/hook.go` to track labels that were removed during an
issue event.

### Testing improvements:
* Added `TestMatchIssuesEvent` in `modules/actions/workflows_test.go` to
cover scenarios such as label addition, label deletion, and label
clearing, ensuring the correct event type is triggered.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2025-09-24 09:45:38 -07:00
Lunny Xiao
198f37e33c Move updateref and removeref to gitrepo and remove unnecessary open repository (#35511)
Extracted from #35077
`UpdateRef` and `RemoveRef` will call git commands even for gogit
version.
2025-09-19 08:04:18 -07:00
ChristopherHX
9a0ec53ee3 Stream repo zip/tar.gz/bundle achives by default (#35487)
Initial implementation of linked proposal.

* Closes #29942
* Fix #34003
* Fix #30443

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-09-19 11:51:21 +08:00
Lunny Xiao
9332ff291b Move git command to git/gitcmd (#35483)
The name cmd is already used in many places and may cause conflicts, so
I chose `gitcmd` instead to minimize potential naming conflicts.
2025-09-15 23:33:12 -07:00
Gnanakeethan Balasubramaniam
fe5afcb022 Exposing TimeEstimate field in the API (#35475)
Time Estimate field is not included in the issue modification webhooks
or issue API endpoints.

This PR fixes the field for the API.

---------

Signed-off-by: Gnanakeethan Balasubramaniam <gnanakeethan@users.noreply.github.com>
Signed-off-by: Gnanakeethan Balasubramaniam <gnanakeethan@cloudparallax.com>
2025-09-16 04:32:03 +00:00
wxiaoguang
4fe1066a17 Replace gobwas/glob package (#35478)
https://github.com/gobwas/glob is unmaintained and has bugs.
2025-09-13 18:01:00 +00:00
luzpaz
688abac5ca Fix various typos in codebase (#35480) 2025-09-13 10:34:43 -04:00
ChristopherHX
84812e42df Fix SSH signing key path will be displayed in the pull request UI (#35381)
Closes #35361

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-09-12 03:00:18 +00:00
Lunny Xiao
89d7929711 Fix package link setting can only list limited repositories (#35394)
Fix #24801

<img width="1123" height="503" alt="image"
src="https://github.com/user-attachments/assets/823f4214-e08a-4506-9018-057c50e7fc52"
/>

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2025-09-11 01:50:17 +02:00
Lunny Xiao
e35e724e42 Use db.WithTx/WithTx2 instead of TxContext when possible (#35428) 2025-09-10 03:15:01 +00:00
Lunny Xiao
b9efbe9fe6 Fix push commits comments when changing the pull request target branch (#35386)
When changing the pull request target branch, the pushed commits
comments will not be changed resulted the number are inconsistent
between commits tab number and the pushed commits comments number.

This PR will remove all the previous pushed commits comments and
calculate new comments when changing the target branch.

Before:

<img width="928" height="585" alt="image"
src="https://github.com/user-attachments/assets/35e4d31f-31a1-4d14-83b0-1786721ab0d9"
/>

After:
<img width="816" height="623" alt="image"
src="https://github.com/user-attachments/assets/24b6dafe-9238-4e7e-833d-68472457afab"
/>
2025-09-09 19:40:54 +00:00
ulnanlu
09d1f359d5 fix(webhook/discord): fixed username cannot be empty error (#35412)
username field is not required by discord and used to override the
default username. sending it as blank causes a 400 error. it should be
omitted instead when it's not set.

Ref:
https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params

Closes #35411
2025-09-05 11:19:31 -07:00
NorthRealm
07347634aa Refactor and update mail templates (#35150)
- Moved mail templates to new directories.
- Added new devtest ymls.
- Embedded styles as much as possible.
- Added new translation keys for actions email.

---------

Signed-off-by: NorthRealm <155140859+NorthRealm@users.noreply.github.com>
Co-authored-by: delvh <dev.lh@web.de>
2025-09-04 20:20:42 -07:00
Lunny Xiao
e96ef97989 Upgrade dependencies (#35384)
- ~Upgrade golang to 1.25~ blocked by the issue
https://github.com/go-swagger/go-swagger/issues/3220
- Upgrade minor versions of most dependencies
- Upgrade github.com/google/go-github version to v74
- Fix meilisearch because of sdk interface change
- Use github.com/Necoro/html2text which is a fork instead of html2text
because of https://github.com/jaytaylor/html2text/issues/67 which
resulted in complie failure.
- Fix some deprecated methods of gitlab go client.
2025-09-02 23:13:38 -04:00
Lunny Xiao
1717af72c4 Move some functions from package git to gitrepo (#33910)
Follow #33874
2025-09-01 19:13:18 +00:00
Lunny Xiao
d2e994db2c Move git config/remote to gitrepo package and add global lock to resolve possible conflict when updating repository git config file (#35151)
Partially fix #32018 

`git config` and `git remote` write operations create a temporary file
named `config.lock`. Since these operations are not atomic, they must
not be run in parallel. If two requests attempt to modify the same
repository concurrently—such as during a compare operation—one may fail
due to the presence of an existing `config.lock` file.

In cases where `config.lock` is left behind due to an unexpected program
exit, a global lock mechanism could allow us to safely remove the stale
lock file when a related error is detected. While this behavior is not
yet implemented in this PR, it is planned for a future enhancement.

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-09-01 18:47:04 +00:00
Lunny Xiao
4e1b8db1fc Move HasWiki to repository service package (#33912)
Move HasWiki out of the models package to avoid referencing the absolute
wiki path directly.
2025-09-01 11:12:58 -07:00
Lunny Xiao
fb056bf4ed Use gitrepo.SetDefaultBranch when set default branch of wiki repository (#33911) 2025-08-28 06:06:39 +00:00
Lunny Xiao
7636d581d9 Deleting branch could delete broken branch which has database record but git branch is missing (#35360)
For some reasons, branches between database and git are not synced. If a
branch exists in database but not in the git, it should be able to be
deleted.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-08-27 22:32:22 -07:00
wxiaoguang
0cbaa0b662 Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
wxiaoguang
60246730b5 Remove wrong "git.DefaultContext" (#35364) 2025-08-27 16:31:21 +00:00
wxiaoguang
e837c998b7 Fix context usages (#35348) 2025-08-27 11:00:01 +00:00
LyricWulf
da5ce5c8e7 Instance signing rule pubkey should allow all public keys, not just GPG (#35357)
Instance signing rule `pubkey` is described as "Only sign if the user
has a public key", however if the user only has SSH public keys, this
check will fail, as it only checks for GPG keys.

Changed the `pubkey` checks to call a helper `userHasPubkeys` which
sequentially checks for GPG, then SSH keys.

Related #34341

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-08-26 15:06:37 -07:00
NorthRealm
c7b99c8cc7 Prevent duplicate actions email (#35215)
Trying to prevent duplicate action emails by adding an extra check on job status.

---------

Signed-off-by: NorthRealm <155140859+NorthRealm@users.noreply.github.com>
Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
2025-08-24 09:30:56 -07:00
techknowlogick
a2d88cd597 Remove deprecated auth sources (#35272)
Entra ID users should use the OIDC oauth2 provider.

They will still be shown if the instance has a previous Azure AD source
configured.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2025-08-23 20:39:05 +00:00
Lunny Xiao
e1fd9e3cd1 Always return the relevant status information, even if no status exists. (#35335) 2025-08-23 18:48:44 +00:00
Lunny Xiao
c0f24bd803 Move organization's visibility change to danger zone. (#34814)
<img width="1185" alt="image"
src="https://github.com/user-attachments/assets/d48c4db2-df7c-43b3-986c-62e042190a51"
/>

<img width="829" alt="image"
src="https://github.com/user-attachments/assets/772b8a14-6837-41f2-9d78-9f0489ef1c7d"
/>

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-08-20 20:57:42 -07:00
LePau
08a7e65c84 Fix LFS range size header response (#35277)
Fix #35276

Signed-off-by: LePau <101608950+LePau@users.noreply.github.com>
2025-08-16 16:51:45 +00:00
wxiaoguang
621f2fcadb Skip "parentsigned" check when the repo is empty (#35292)
Fix #35280
2025-08-16 19:24:30 +03:00
Alex Blackie
9549c6641a Fix GitHub release assets URL validation (#35287)
GitHub changed where the attachments on releases are stored, which means
repo migrations with releases now fail because the redirect URLs don't
match the base URL validation. We need to update the base URL check to
check for the `release-assets` subdomain as well.
2025-08-15 17:50:05 -04:00
Tim Biermann
4ff8cdf826 Fix token lifetime, closes #35230 (#35271)
This is an attempt to fix #35230 as discussed in the ticket.
2025-08-14 06:57:05 +00:00
Karl T
ee4459488a OneDev migration: fix broken migration caused by various REST API changes in OneDev 7.8.0 and later (#35216)
OneDev migration: fix broken migration caused by various REST API
changes in OneDev 7.8.0 and later

- in REST urls use `~api` instead of `api`
- check minimum required OneDev version before starting migration
- required OneDev version is now 12.0.1
(older versions do not offer necessary API:
https://code.onedev.io/onedev/server/~issues/2491)
- support migrating OneDev subprojects (e.g.
http:/onedev.host/projectA/subProjectB)
- set milestone closed state if milestone is closed in OneDev
- moved memory allocation for milestone JSON decoding into for loop
(which gets 100 milestones per iteration) to fix wrong due dates when
having more than 100 milestones
2025-08-13 23:30:35 -07:00
Lunny Xiao
90a48e96c7 Fix a bug where lfs gc never worked. (#35198)
Fix #31113

After #22385 introduced LFS GC, it never worked due to a bug in the INI
library: fields in structs embedded more than one level deep are not
populated from the INI file.

This PR fixes the issue by replacing the multi-level embedded struct
with a single-level struct for parsing the cron.gc_lfs configuration.

Added a new test for retrieving cron settings to demonstrate the bug in
the INI package.
2025-08-12 05:38:17 +00:00