aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo
Commit message (Collapse)AuthorAgeFilesLines
* Enable gocritic `equalFold` and fix issues (#34952)silverwind5 hours2-2/+2
| | | | | | | Continuation of https://github.com/go-gitea/gitea/pull/34678. --------- Signed-off-by: silverwind <me@silverwind.io>
* Support getting last commit message using contents-ext API (#34904)RickyMa4 days1-3/+16
| | | | | | | | Fix #34870 Fix #34929 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add a `login`/`login-name`/`username` disambiguation to affected endpoint ↵AlexMaryW7 days3-6/+6
| | | | | | | | | | | | parameters and response/request models (#34901) Issue: [link](https://github.com/go-gitea/gitea/issues/9637) Changes introduced: I have clarified the problematic terms (`login`, `login_name`, and `username`) in all affected endpoints. The changes were made to relevant: - HTTP endpoint parameters' descriptions - response/request models' fields
* enforce nolint scope (#34851)TheFox0x710 days1-4/+4
| | | | | | | | | | | | | | | enable nolintlint scope requirement add comments to new directives so it's more obvious why they are in place --- I can also toggle the mandatory comments on if that's something of interest. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Refactor "change file" API (#34855)wxiaoguang11 days2-276/+114
| | | | | | | | | Follow up the "editor" refactor, use the same approach to simplify code, and fix some docs & comments --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* Refactor repo contents API and add "contents-ext" API (#34822)wxiaoguang12 days3-12/+78
| | | See the updated swagger document for details.
* fix(issue): Replace stopwatch toggle with explicit start/stop actions (#34818)Junsik Kong12 days1-31/+25
| | | | | | | | | | | | | | | | This PR fixes a state de-synchronization bug with the issue stopwatch, it resolves the issue by replacing the ambiguous `/toggle` endpoint with two explicit endpoints: `/start` and `/stop`. - The "Start timer" button now exclusively calls the `/start` endpoint. - The "Stop timer" button now exclusively calls the `/stop` endpoint. This ensures the user's intent is clearly communicated to the server, eliminating the state inconsistency and fixing the bug. --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor editor (#34780)wxiaoguang2025-06-211-0/+3
| | | A complete rewrite
* Add workflow_run api + webhook (#33964)ChristopherHX2025-06-201-2/+261
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements - https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#list-jobs-for-a-workflow-run--code-samples - https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#get-a-job-for-a-workflow-run--code-samples - https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository - https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#get-a-workflow-run - `/actions/runs` for global + user + org (Gitea only) - `/actions/jobs` for global + user + org + repository (Gitea only) - workflow_run webhook + action trigger - limitations - workflow id is assigned to a string, this may result into problems in strongly typed clients Fixes - workflow_job webhook url to no longer contain the `runs/<run>` part to align with api - workflow instance does now use it's name inside the file instead of filename if set Refactoring - Moved a lot of logic from workflows/workflow_job into a shared module used by both webhook and api TODO - [x] Verify Keda Compatibility - [x] Edit Webhook API bug is resolved Closes https://github.com/go-gitea/gitea/issues/23670 Closes https://github.com/go-gitea/gitea/issues/23796 Closes https://github.com/go-gitea/gitea/issues/24898 Replaces https://github.com/go-gitea/gitea/pull/28047 and is much more complete --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add ff_only parameter to POST /repos/{owner}/{repo}/merge-upstream (#34770)Dan Čermák2025-06-191-1/+1
| | | | | | | | | The merge-upstream route was so far performing any kind of merge, even those that would create merge commits and thus make your branch diverge from upstream, requiring manual intervention via the git cli to undo the damage. With the new optional parameter ff_only, we can instruct gitea to error out, if a non-fast-forward merge would be performed.
* Support annotated tags when using create release API (#31840)Kemal Zebari2025-06-181-1/+3
| | | | | | | | | | This adds a new field, "tag_message", that represents the message of the annotated tag. Resolves #31835. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Remove unused param `doer` (#34545)Philip Peterson2025-06-181-1/+1
|
* Run `gopls modernize` on codebase (#34751)silverwind2025-06-182-16/+4
| | | | Recent modernize fixes: https://github.com/golang/tools/commits/master/gopls/internal/analysis/modernize
* Fix possible pull request broken when leave the page immediately after ↵Lunny Xiao2025-06-041-1/+2
| | | | | | | | | | clicking the update button (#34509) If user leaves the page, the context will become cancelled, so that the update process maybe terminal in an unexpected status. This PR haven't resolve the problem totally. It uses a background context to not cancel the update process even if the user leaved the pull request view page. Fix #31779
* Do not mutate incoming options to SearchRepositoryByName (#34553)Philip Peterson2025-06-022-2/+2
| | | | | | | | | | | | | | Similar to #34544, this PR changes the `opts` argument in `SearchRepositoryByName()` to be passed by value instead of by pointer, as its mutations do not escape the function scope and are not used elsewhere. This simplifies reasoning about the function and avoids unnecessary pointer usage. This insight emerged during an initial attempt to refactor `RenderUserSearch()`, which currently intermixes multiple concerns. --------- Co-authored-by: Philip Peterson <philip-peterson@users.noreply.github.com>
* Split GetLatestCommitStatus as two functions (#34535)Lunny Xiao2025-05-261-3/+8
| | | | | | | | Extract from #34531. This will reduce unnecessary count operation in databases. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add sort option recentclose for issues and pulls (#34525)Markus Amshove2025-05-261-1/+1
| | | | | | closes #34171 Adds a new sort option `recentclose` for issues and pull requests which will return items in a descending order of when they were closed
* fix: return 201 Created for CreateVariable API responses (#34517)Bo-Yi Wu2025-05-261-5/+5
| | | | | | | | | | | | | | | | | | | - Change CreateVariable API response status from 204 No Content to 201 Created - Update related integration tests to expect 201 Created instead of 204 No Content ## :warning: BREAKING :warning: Change the response status code of the Create Variable API under both Org and Repo levels to `201` instead of 204. API SDK: https://gitea.com/gitea/go-sdk/pulls/713 --------- Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> Signed-off-by: appleboy <appleboy.tw@gmail.com> Co-authored-by: delvh <dev.lh@web.de>
* feat(api): add date range filtering to commit retrieval endpoints (#34497)Bo-Yi Wu2025-05-191-1/+35
| | | | | | | | | | | | | | | - Add support for filtering commits by date range via new "since" and "until" parameters - Update API endpoints and command logic to handle the new parameters for fetching commits within given dates - Extend API documentation and Swagger specs to describe the new "since" and "until" query parameters - Refactor related function signatures and implementations to accept and pass "since" and "until" values --------- Signed-off-by: appleboy <appleboy.tw@gmail.com> Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* Add endpoint deleting workflow run (#34337)NorthRealm2025-05-131-0/+52
| | | | | | | | | | | Add endpoint deleting workflow run Resolves #26219 /claim #26219 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix bug webhook milestone is not right. (#34419)Lunny Xiao2025-05-112-0/+14
| | | | | | | Fix #34400 --------- Co-authored-by: silverwind <me@silverwind.io>
* When updating comment, if the content is the same, just return and not ↵Lunny Xiao2025-05-111-8/+10
| | | | | update the databse (#34422) Fix #34318
* Fix bug when API get pull changed files for deleted head repository (#34333)Lunny Xiao2025-05-041-1/+3
|
* Option to delay conflict checking of old pull requests until page view (#27779)Brecht Van Lommel2025-04-241-2/+10
| | | | | | | | | | | | | | | | | | | | | | `[repository.pull-request] DELAY_CHECK_FOR_INACTIVE_DAYS` is a new setting to delay the mergeable check for pull requests that have been inactive for the specified number of days. This avoids potentially long delays for big repositories with many pull requests. and reduces system load overall when there are many repositories or pull requests. When viewing the PR, checking will start immediately and the PR merge box will automatically reload when complete. Accessing the PR through the API will also start checking immediately. The default value of `7` provides a balance between system load, and keeping behavior similar to what it was before both for users and API access. With `0` all conflict checking will be delayed, while `-1` always checks immediately to restore the previous behavior. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improve "not found" error messages for API (#34267)wxiaoguang2025-04-234-6/+5
| | | Make the message clear, for example: #34266
* Add API endpoint to request contents of multiple files simultaniously (#34139)Denys Konovalov2025-04-222-32/+128
| | | | | | | | | | | | | | | | Adds an API POST endpoint under `/repos/{owner}/{repo}/file-contents` which receives a list of paths and returns a list of the contents of these files. This API endpoint will be helpful for applications like headless CMS (reference: https://github.com/sveltia/sveltia-cms/issues/198) which need to retrieve a large number of files by reducing the amount of needed API calls. Close #33495 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add API routes to lock and unlock issues (#34165)YaFou2025-04-211-0/+152
| | | | | | | | | | | | | | | This pull request adds a GitHub-compatible API endpoint to lock and unlock an issue. The following routes exist now: - `PUT /api/v1/repos/{owner}/{repo}/issues/{id}/lock` to lock an issue - `DELETE /api/v1/repos/{owner}/{repo}/issues/{id}/lock` to unlock an issue Fixes #33677 Fixes #20012 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Don't assume the default wiki branch is master in the wiki API (#34244)Kemal Zebari2025-04-191-4/+4
| | | | | | Resolves #34218. In the recent past, the default wiki branch was made to be changeable. This change reflects this.
* Actions Runner rest api (#33873)ChristopherHX2025-04-181-1/+120
| | | | | | | | | | | | | | | | | | | | | | | | | Implements runner apis based on https://docs.github.com/en/rest/actions/self-hosted-runners?apiVersion=2022-11-28#list-self-hosted-runners-for-an-organization - Add Post endpoints for registration-token, google/go-github revealed this as problem - We should deprecate Get Endpoints, leaving them for compatibility - Get endpoint of admin has api path /admin/runners/registration-token that feels wrong, /admin/actions/runners/registration-token seems more consistent with user/org/repo api - Get Runner Api - List Runner Api - Delete Runner Api - Tests admin / user / org / repo level endpoints Related to #33750 (implements point 1 and 2) Via needs discovered in #32461, this runner api is needed to allow cleanup of runners that are deallocated without user interaction. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix bug when migrating repository (#34182)Lunny Xiao2025-04-141-1/+1
| | | This PR fixed a bug which is a regression from #31035
* Fix team permission (#34128)wxiaoguang2025-04-081-1/+1
| | | | The `team.access_mode` should be either `none` or `admin/owner`. For non-admin team, the real permissions are provided by `team_unit`.
* Avoid creating unnecessary temporary cat file sub process (#33942)Lunny Xiao2025-04-041-1/+1
| | | | | | | | | | | | | Extract from #33934 In the same goroutine, we should reuse the exist cat file sub process which exist in `git.Repository` to avoid creating a unnecessary temporary subprocess. This PR reuse the exist cate file writer and reader in `getCommitFromBatchReader`. It also move `prepareLatestCommitInfo` before creating dataRc which will hold the writer so other git operation will create a temporary cat file subprocess.
* Refactor Branch struct in package modules/git (#33980)Lunny Xiao2025-04-022-24/+11
| | | | The `Branch` struct in `modules/git` package is unnecessary. We can just use a `string` to represent a branch
* Fix return bug (#34093)Lunny Xiao2025-04-011-1/+1
| | | Fix https://github.com/go-gitea/gitea/pull/34031/files#r2021927997
* Enable addtional linters (#34085)TheFox0x72025-04-0113-34/+33
| | | | | | | | enable mirror, usestdlibbars and perfsprint part of: https://github.com/go-gitea/gitea/issues/34083 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* fix users being able bypass limits with repo transfers (#34031)TheFox0x72025-03-311-11/+10
| | | | prevent user from being able to transfer repo to user who cannot have more repositories
* Enable testifylint rules (#34075)TheFox0x72025-03-312-3/+3
| | | | enable testifylint rules disabled in: https://github.com/go-gitea/gitea/pull/34054
* enable staticcheck QFxxxx rules (#34064)TheFox0x72025-03-291-2/+2
|
* Download actions job logs from API (#33858)Lunny Xiao2025-03-261-0/+64
| | | | | | | | | | | | | | Related to #33709, #31416 It's similar with https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#download-job-logs-for-a-workflow-run--code-samples. This use `job_id` as path parameter which is consistent with Github's APIs. --------- Co-authored-by: ChristopherHX <christopher.homberger@web.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Allow filtering issues by any assignee (#33343)Andreas Svanberg2025-03-211-4/+4
| | | | | | | | | | | | | | | | This is the opposite of the "No assignee" filter, it will match all issues that have at least one assignee. Before ![Before change](https://github.com/user-attachments/assets/4aea194b-9add-4a84-8d6b-61bfd8d9e58e) After ![After change with any filter](https://github.com/user-attachments/assets/99f1205d-ba9f-4a0a-a60b-cc1a0c0823fe) --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Don't create duplicated functions for code repositories and wiki ↵Lunny Xiao2025-03-191-1/+1
| | | | | | | | | | repositories (#33924) Fix https://github.com/go-gitea/gitea/pull/33910#pullrequestreview-2688913865 This PR changed the Repositroy interface in `gitrepo` package which makes it only focus the relative path in the disk and abstract whether it's a wiki repository or not.
* Added Description Field for Secrets and Variables (#33526)John Smith2025-03-171-11/+16
| | | | | | | Fixes #33484 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Move git references checking to gitrepo packages to reduce expose of ↵Lunny Xiao2025-03-153-4/+4
| | | | repository path (#33891)
* Refactor cache-control (#33861)wxiaoguang2025-03-131-2/+2
| | | And fix #21391
* Fix auto concurrency cancellation skips commit status updates (#33764)ChristopherHX2025-03-101-2/+1
| | | | | | | | * add missing commit status * conflicts with concurrency support Closes #33763 Co-authored-by: Giteabot <teabot@gitea.io>
* Full-file syntax highlighting for diff pages (#33766)Dustin Firebaugh2025-03-091-2/+1
| | | | | | | | | | | | Fix #33358, fix #21970 This adds a step in the `GitDiffForRender` that does syntax highlighting for the entire file and then only references lines from that syntax highlighted code. This allows things like multi-line comments to be syntax highlighted correctly. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Decouple diff stats query from actual diffing (#33810)wxiaoguang2025-03-081-1/+7
| | | | | | | | | The diff stats are no longer part of the diff generation. Use `GetDiffShortStat` instead to get the total number of changed files, added lines, and deleted lines. As such, `gitdiff.GetDiff` can be simplified: It should not do more than expected. And do not run "git diff --shortstat" for pull list. Fix #31492
* Refactor: move part of updating protected branch logic to service layer (#33742)Lunny Xiao2025-03-051-37/+1
|
* allow filtering /repos/{owner}/{repo}/pulls by target base branch queryparam ↵Royce Remer2025-02-271-0/+5
| | | | | | (#33684) Co-authored-by: Royce Remer <rremer@salesforce.com> Co-authored-by: delvh <dev.lh@web.de>
* Fix some user name usages (#33689)wxiaoguang2025-02-231-2/+4
| | | | | | | 1. GetUserOrgsList should "order by" lower_name 2. GetIssuePostersWithSearch should search in-case-sensitive-ly 3. LoginName should not be used as username By the way, remove unnecessary "onGiteaRun"