aboutsummaryrefslogtreecommitdiffstats
path: root/services
Commit message (Collapse)AuthorAgeFilesLines
* Interpolate runs-on with variables when scheduling tasks(#30640) (#30672)sillyguodong2024-04-241-1/+7
| | | | | backport: #30640 Co-authored-by: Giteabot <teabot@gitea.io>
* Use action user as the trigger user of schedules (#30581) (#30609)Giteabot2024-04-201-2/+7
| | | | | | | | | | | | | | | | | Backport #30581 by @yp05327 Follow https://github.com/go-gitea/gitea/pull/30357 When user push to default branch, the schedule trigger user will be the user. When disable then enable action units in settings, the schedule trigger user will be action user. When repo is a mirror, the schedule trigger user will be action user. ( before it will return error, fixed by #30357) As scheduled job is a cron, the trigger user should be action user from Gitea, not a real user. Co-authored-by: yp05327 <576951401@qq.com>
* Fix cache bug (#30510)v1.21.11Lunny Xiao2024-04-161-0/+6
| | | | Cache cannot be disabled from v1.22. So it still maybe `nil` in v1.21, we have to check whether cache is `nil`.
* Fix code owners will not be mentioned when a pull request comes from a ↵Lunny Xiao2024-04-161-4/+4
| | | | | | | forked repository (#30476) (#30497) Backport #30476 Fix #30277 Caused by #29783
* Fix commit status cache which missed target_url (#30426) (#30445)Lunny Xiao2024-04-151-12/+38
| | | | | | Fix #30421 Backport #30426 Co-authored-by: Jason Song <i@wolfogre.com>
* Avoid losing token when updating mirror settings (#30429) (#30466)Lunny Xiao2024-04-151-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix #30416. Backport #30429 Before (it shows as "Unset" while there's a token): <img width="980" alt="image" src="https://github.com/go-gitea/gitea/assets/9418365/d7148e3e-62c9-4d2e-942d-3d795b79515a"> After: <img width="977" alt="image" src="https://github.com/go-gitea/gitea/assets/9418365/24aaa1db-5baa-4204-9081-470b15ea72b5"> The username shows as "oauth2" because of https://github.com/go-gitea/gitea/blob/f9fdac9809335729b2ac3227b2a5f71a62fc64ad/services/migrations/dump.go#L99 I have checked that all usage of `MirrorRemoteAddress` has been updated. <img width="1806" alt="image" src="https://github.com/go-gitea/gitea/assets/9418365/2f042501-2824-4511-9203-c84a6731a02d"> However, it needs to be checked again when backporting. Co-authored-by: Jason Song <i@wolfogre.com>
* Change the default maxPerPage for gitbucket (#30392) (#30471)Lunny Xiao2024-04-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #30392 This patch improves the migration from gitbucket to gitea. The gitbucket uses it's own internal perPage value (= 25) for paging and ignore per_page arguments in the requested URL. This cause gitea to migrate only 25 issues and 25 PRs from gitbucket repository. This may not happens on old gitbucket. But recent gitbucket 4.40 or 4.38.4 has this problem. This patch change to use this internally hardcoded perPage of gitbucket as gitea's maxPerPage numer when migrating from gitbucket. There are several perPage values in gitbucket like 25 for Isseus/PRs and 10 for Releases. Some of those API doesn't support paging yet. It sounds difficult to implement, but using the minimum number among them worked out very well. So, I use 10 in this patch. Brief descriptions of problems and this patch are also available in https://github.com/go-gitea/gitea/issues/30316. In addition, I'm not sure what kind of test cases are possible to write here. It's a test for migration, so it requires testing gitbucket server and gitea server, I guess. Please let me know if it is possible to write such test cases here. Thanks! Co-authored-by: Kazushi (Jam) Marukawa <jam@pobox.com>
* Fix mirror error when mirror repo is empty (#30432) (#30467)yp053272024-04-141-17/+23
| | | | | | | | | Backport #30432 Fix https://github.com/go-gitea/gitea/issues/30424 ps: convert `gitrepo.OpenRepository` to `git.OpenRepository` remove `ctx` from `checkAndUpdateEmptyRepository` Co-authored-by: Giteabot <teabot@gitea.io>
* fix: Fix to delete cookie when AppSubURL is non-empty (#30375) (#30468)Giteabot2024-04-141-1/+2
| | | | | | | | | | | Backport #30375 by @jtran Cookies may exist on "/subpath" and "/subpath/" for some legacy reasons (eg: changed CookiePath behavior in code). The legacy cookie should be removed correctly. Co-authored-by: Jonathan Tran <jonnytran@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Kyle D <kdumontnu@gmail.com>
* Check the token's owner and repository when registering a runner (#30406) ↵Zettat1232024-04-112-0/+2
| | | | | | | (#30412) Backport #30406 Fix #30378
* Avoid user does not exist error when detecting schedule actions when the ↵Giteabot2024-04-111-6/+3
| | | | | | | | | | | | | | | | | | | | commit author is an external user (#30357) (#30408) Backport #30357 by @yp05327 ![image](https://github.com/go-gitea/gitea/assets/18380374/ddf6ee84-2242-49b9-b066-bd8429ba4d76) When repo is a mirror, and commit author is an external user, then `GetUserByEmail` will return error. reproduce/test: - mirror Gitea to your instance - disable action and enable it again, this will trigger `DetectAndHandleSchedules` ps: also follow #24706, it only fixed normal runs, not scheduled runs. Co-authored-by: yp05327 <576951401@qq.com>
* Performance optimization for git push (#30104) (#30354)Lunny Xiao2024-04-101-9/+17
| | | | | | | Agit returned result should be from `ProcReceive` hook but not `PostReceive` hook. Then for all non-agit pull requests, it will not check the pull requests for every pushing `refs/pull/%d/head`. Backport #30104
* Fix create commit status (#30225) (#30340)Lunny Xiao2024-04-081-8/+11
| | | | | | Partially backport #30223 This PR uses the service layer `CreateCommitstatus` method instead of the git model method.
* Fix possible data race on tests (#30093) (#30108)Lunny Xiao2024-03-261-1/+0
| | | backport #30093
* Fix duplicate migrated milestones (#30102) (#30105)yp053272024-03-261-2/+1
| | | backport #30102
* Fix Add/Remove WIP on pull request title failure (#29999) (#30066)Lunny Xiao2024-03-252-21/+20
| | | | Fix #29997 Backport #29999
* Fix bugs in rerunning jobs (#29955) (#29983)Giteabot2024-03-222-0/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #29955 by @Zettat123 Fix #28761 Fix #27884 Fix #28093 ## Changes ### Rerun all jobs When rerun all jobs, status of the jobs with `needs` will be set to `blocked` instead of `waiting`. Therefore, these jobs will not run until the required jobs are completed. ### Rerun a single job When a single job is rerun, its dependents should also be rerun, just like GitHub does (https://github.com/go-gitea/gitea/issues/28761#issuecomment-2008620820). In this case, only the specified job will be set to `waiting`, its dependents will be set to `blocked` to wait the job. ### Show warning if every job has `needs` If every job in a workflow has `needs`, all jobs will be blocked and no job can be run. So I add a warning message. <img src="https://github.com/go-gitea/gitea/assets/15528715/88f43511-2360-465d-be96-ee92b57ff67b" width="480px" /> --------- Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Performance improvements for pull request list page (#29900) (#29972)Lunny Xiao2024-03-222-4/+5
| | | | | | | | | This PR will avoid load pullrequest.Issue twice in pull request list page. It will reduce x times database queries for those WIP pull requests. Partially fix #29585 Backport #29900
* Fix the bug that user may logout if GetUserByID return unknow error (#29964)Lunny Xiao2024-03-211-17/+9
| | | | | | | | | | | | backport #29962 This PR fixed a bug when the user switching pages too fast, he will logout automatically. The reason is that when the error is context cancelled, the previous code think user hasn't login then the session will be deleted. Now it will return the errors but not think it's not login. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix loadOneBranch panic (#29938) (#29939)wxiaoguang2024-03-201-4/+6
| | | | | | | Backport #29938 Try to fix #29936 Far from ideal, but still better than panic.
* Add cache for dashbaord commit status (#29932)Lunny Xiao2024-03-202-44/+138
| | | backport #29444
* Notify reviewers added via CODEOWNERS (#29842) (#29902)Lunny Xiao2024-03-204-22/+77
| | | | | backport #29842 Co-authored-by: Jimmy Praet <jimmy.praet@telenet.be>
* Fix invalid link of the commit status when ref is tag (#29752) (#29908)yp053272024-03-201-3/+13
| | | | | | | Backport #29752 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix codeowner detected diff base branch to mergebase (#29783) (#29807)Lunny Xiao2024-03-178-8/+129
| | | | | | | | | | | | | | | Fix #29763 Backport #29783 This PR fixes 2 problems with CodeOwner in the pull request. - Don't use the pull request base branch but merge-base as a diff base to detect the code owner. - CodeOwner detection in fork repositories will be disabled because almost all the fork repositories will not change CODEOWNERS files but it should not be used on fork repositories' pull requests. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Make runs-on support variable expression (#29468) (#29782)sillyguodong2024-03-141-1/+12
| | | | | | | | | backport #29468 Close issue: https://gitea.com/gitea/act_runner/issues/445 Follow: https://gitea.com/gitea/act/pulls/91 Move `getSecretsOfTask` and `getVariablesOfTask` under models because of circular dependency issues.
* Fix possible NPE in ToPullReviewList (#29759) (#29775)Giteabot2024-03-132-1/+53
| | | | | | Backport #29759 by @lunny Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix commit_status problem when testing (#29672) (#29675)Giteabot2024-03-081-1/+1
| | | | | | | | | Backport #29672 by @charles7668 Close #29661 fix #29656 Co-authored-by: charles <30816317+charles7668@users.noreply.github.com>
* Add empty repo check in DetectAndHandleSchedules (#29606) (#29659)yp053272024-03-081-0/+4
| | | Backport #29606
* Fixing the issue when status check per rule matches multiple actions ↵Giteabot2024-03-082-7/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#29631) (#29655) Backport #29631 by @charles7668 Close #29628 rule ``` Test / Build* Test / Build * Test / Build 2* Test / Build 1* ``` ![image](https://github.com/go-gitea/gitea/assets/30816317/19bef0a9-fa97-43c5-887b-dece76064aa8) rule2 ``` Test / Build* Test / Build 1* ``` ![image](https://github.com/go-gitea/gitea/assets/30816317/19bef0a9-fa97-43c5-887b-dece76064aa8) rule3 ``` Test / Build* Test / Build 1* NotExist* ``` ![image](https://github.com/go-gitea/gitea/assets/30816317/f6a5e832-2e1b-4049-915b-45bec5ef070c) Co-authored-by: charles <30816317+charles7668@users.noreply.github.com> Co-authored-by: Zettat123 <zettat123@gmail.com>
* Use strict protocol check when redirect (#29642) (#29644)Giteabot2024-03-071-0/+39
| | | | | Backport #29642 by wxiaoguang Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add missing database transaction for new issue (#29490) (#29607)Lunny Xiao2024-03-051-7/+16
| | | | | | When creating an issue, inserting issue, assign users and set project should be in the same transaction. Backport #29490
* Fix workflow trigger event IssueChangeXXX bug (#29559) (#29565)Giteabot2024-03-041-2/+14
| | | | | | | | | | Backport #29559 by @yp05327 Bugs from #29308 Follow #29467 partly fix #29558 Co-authored-by: yp05327 <576951401@qq.com>
* Fix incorrect relative/absolute URL usages (#29531) (#29547)Giteabot2024-03-021-1/+1
| | | | | | | | Backport #29531 by wxiaoguang Add two "HTMLURL" methods for PackageDescriptor. And rename "FullWebLink" to "VersionWebLink" Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix workflow trigger event bugs (#29467) (#29475)Giteabot2024-02-281-1/+7
| | | | | | | | | | Backport #29467 by @Zettat123 1. Fix incorrect `HookEventType` for issue-related events in `IssueChangeAssignee` 2. Add `case "types"` in the `switch` block in `matchPullRequestEvent` to avoid warning logs Co-authored-by: Zettat123 <zettat123@gmail.com>
* The job should always run when `if` is `always()` (#29464) (#29469)Giteabot2024-02-282-1/+76
| | | | | | | | | | | | | | | Backport #29464 by @Zettat123 Fix #27906 According to GitHub's [documentation](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds), a job should always run when its `if` is `always()` > If you would like a job to run even if a job it is dependent on did not succeed, use the `always()` conditional expression in `jobs.<job_id>.if`. Co-authored-by: Zettat123 <zettat123@gmail.com>
* Ignore empty repo for CreateRepository in action notifier (#29416) (#29424)Giteabot2024-02-261-0/+3
| | | | | | | Backport #29416 by @yp05327 Fix #29415 Co-authored-by: yp05327 <576951401@qq.com>
* Fix tarball/zipball download bug (#29342) (#29352)Giteabot2024-02-232-1/+6
| | | | | | | | | | | Backport #29342 by @Zettat123 Fix #29249 ~~Use the `/repos/{owner}/{repo}/archive/{archive}` API to download.~~ Apply #26430 to archive download URLs. Co-authored-by: Zettat123 <zettat123@gmail.com>
* Use general token signing secret (#29205) (#29325)wxiaoguang2024-02-222-9/+3
| | | | | Backport #29205 (including #29172) Use a clearly defined "signing secret" for token signing.
* Fix SSPI user creation (#28948) (#29323)Lunny Xiao2024-02-221-7/+3
| | | | | | | | | Fixes #28945 Backport #28948 Setting the avatar is wrong and creating a random password is equal to leave it empty. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Improve the `issue_comment` workflow trigger event (#29277) (#29322)Giteabot2024-02-222-27/+80
| | | | | | | | | | | | | | | | | | | | | Backport #29277 by @Zettat123 Fix #29175 Replace #29207 This PR makes some improvements to the `issue_comment` workflow trigger event. 1. Fix the bug that pull requests cannot trigger `issue_comment` workflows 2. Previously the `issue_comment` event only supported the `created` activity type. This PR adds support for the missing `edited` and `deleted` activity types. 3. Some events (including `issue_comment`, `issues`, etc. ) only trigger workflows that belong to the workflow file on the default branch. This PR introduces the `IsDefaultBranchWorkflow` function to check for these events. Co-authored-by: Zettat123 <zettat123@gmail.com>
* Implement some action notifier functions (#29173) (#29308)yp053272024-02-221-9/+67
| | | | | | | | | | | | | Backport #29173 Fix #29166 Add support for the following activity types of `pull_request` - assigned - unassigned - review_requested - review_request_removed - milestoned - demilestoned
* Fix missing link on outgoing new release notifications (#29079) (#29300)wxiaoguang2024-02-211-0/+1
| | | | | | | Backport #29079 Signed-off-by: Wiktor Kwapisiewicz <wiktor@metacode.biz> Co-authored-by: Wiktor Kwapisiewicz <wiktor@metacode.biz> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix debian InRelease Acquire-By-Hash newline (#29204) (#29299)wxiaoguang2024-02-211-1/+1
| | | | | Backport #29204 Co-authored-by: Robin Schoonover <robin@cornhooves.org>
* Fix missed edit issues event for actions (#29237) (#29251)Lunny Xiao2024-02-201-0/+41
| | | | Fix #29213 Backport #29237
* Disallow merge when required checked are missing (#29143) (#29268)Markus Amshove2024-02-191-0/+4
| | | | | | backport #29143 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix bug when the linked account was disactived and list the linked accounts ↵Lunny Xiao2024-02-192-5/+4
| | | | | | | | | (#29263) The bug has been fixed on v1.22 but not backport to v1.21. This original PR have many refactors so I don't think it's necessary to backport all of them. Fix #28667
* Do not use lower tag names to find releases/tags (#29261) (#29262)Jason Song2024-02-191-6/+6
| | | | | | | | | | | | | | | | Backport #29261. Fix #26090, see https://github.com/go-gitea/gitea/issues/26090#issuecomment-1952013206 Since `TagName` stores the original tag name and `LowerTagName` stores the lower tag name, it doesn't make sense to use lowercase tags as `TagNames` in `FindReleasesOptions`. https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/services/repository/push.go#L396-L397 While the only other usage looks correct: https://github.com/go-gitea/gitea/blob/5e72526da4e915791f03af056890e16821bde052/routers/web/repo/repo.go#L416
* Only delete scheduled workflows when needed (#29091) (#29235)Zettat1232024-02-181-3/+6
| | | | | | | | Backport #29091 Fix #29040 `handleSchedules` should be called only if `DetectWorkflows` should detect schedule workflows
* Refactor issue template parsing and fix API endpoint (#29069) (#29140)wxiaoguang2024-02-141-14/+16
| | | | | | | | | | | | | | | | | | Backport #29069 The old code `GetTemplatesFromDefaultBranch(...) ([]*api.IssueTemplate, map[string]error)` doesn't really follow Golang's habits, then the second returned value might be misused. For example, the API function `GetIssueTemplates` incorrectly checked the second returned value and always responds 500 error. This PR refactors GetTemplatesFromDefaultBranch to ParseTemplatesFromDefaultBranch and clarifies its behavior, and fixes the API endpoint bug, and adds some tests. And by the way, add proper prefix `X-` for the header generated in `checkDeprecatedAuthMethods`, because non-standard HTTP headers should have `X-` prefix, and it is also consistent with the new code in `GetIssueTemplates`
* Avoid sending update/delete release notice when it is draft (#29008) (#29025)Giteabot2024-02-021-8/+7
| | | | | | | Backport #29008 by @yp05327 Fix #27157 Co-authored-by: yp05327 <576951401@qq.com>