Commit graph

25,323 commits

Author SHA1 Message Date
Michael Kriese
47ae5e6841 build: enable go toolchain download on docker images (#9837)
This ensures we use the right go toolchain on docker build even if there is an older image already cached.

Tested manually:
- `docker buildx build --progress plain  -f Dockerfile.rootless .` currently is up-to-date
- change `build-env` image to `golang:1.24-alpine3.22` and run again: see `go: downloading go1.25.3 (linux/amd64)` in output

```diff
diff --git a/Dockerfile.rootless b/Dockerfile.rootless
index 2dbcd6ddd2..8c6ac5f266 100644
--- a/Dockerfile.rootless
+++ b/Dockerfile.rootless
@@ -1,6 +1,6 @@
 FROM --platform=$BUILDPLATFORM data.forgejo.org/oci/xx AS xx

-FROM --platform=$BUILDPLATFORM data.forgejo.org/oci/golang:1.25-alpine3.22 AS build-env
+FROM --platform=$BUILDPLATFORM data.forgejo.org/oci/golang:1.24-alpine3.22 AS build-env

 ARG GOPROXY
 ENV GOPROXY=${GOPROXY:-https://proxy.golang.org,direct}
@@ -10,10 +10,13 @@ ARG TAGS="sqlite sqlite_unlock_notify"
 ENV TAGS="bindata timetzdata $TAGS"
 ARG CGO_EXTRA_CFLAGS

+RUN go env
+
 # it's set to local by default in the base image
 # we want to use auto to let go choose the right toolchain
 ENV GOTOOLCHAIN=auto

+
 #
 # Transparently cross compile for the target platform
 #
@@ -37,6 +40,9 @@ RUN apk --no-cache add build-base git nodejs npm
 COPY . ${GOPATH}/src/forgejo.org
 WORKDIR ${GOPATH}/src/forgejo.org

+
+RUN set -ex; go env;
+
 RUN make clean-no-bindata
 RUN make frontend
 RUN go build contrib/environment-to-ini/environment-to-ini.go && xx-verify environment-to-ini
```

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9837
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-07-04 16:56:25 +02:00
Shiny Nematoda
14c5f0105f enh(issue-search): treat terms in query strings with no explicit operator as MUST (#13025)
The rationale for this decision is the apparent confusion regarding the number of issues that were presented.
For a query such as `foo bar` the natural expectation would be results that contain both `foo` and `bar` not either `foo` or `bar`.
However, for a query such as `+foo bar` the result MUST contain `foo`, while `bar` affects only the scoring of issues.

A downside of such an approach is the inability to fully represent `foo OR bar` as the current implementation imposes that the query must contain atleast one MUST (or MUST NOT) term.

closes #12935

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13025
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-07-04 16:05:50 +02:00
Mai-Lapyst
7a3d9b486e feat: adds "actor" as a protected / forbidden username (#13077)
The username used for the activitypub server actor, "actor" (internal userid -3), was freely available to be registered for any user.
With this patch, it's added to the reversed username list to prevent future creations of such accounts.
Existing users will not be impacted and need to be manually resolved.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13077
2026-07-04 16:01:31 +02:00
steven.guiheux
3062f1b4cc fix: add extraLinesCount to reply template (#13258)
Close #13250

ExtraLinesCount was not send to reply template

### Tests for Go changes

- I added test coverage for Go changes...
  - [X] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [X] `make pr-go` before pushing

### Documentation

- [X] I did not document these changes and I do not expect someone else to do it.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13258
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-07-04 05:02:28 +02:00
Mathieu Fenniak
d4e2bf7396 fix: intermittent test failure in process cancellation (#13293)
Test failure: https://codeberg.org/forgejo/forgejo/actions/runs/174007/jobs/2/attempt/1   Have only observed once and can't reproduce locally, but likely caused by #13263 / #13289.

```
--- FAIL: TestGetDiffPreview (0.20s)
    --- FAIL: TestGetDiffPreview/empty_branch,_same_results (0.02s)
        diff_test.go:132:
            	Error Trace:	/workspace/forgejo/forgejo/services/repository/files/diff_test.go:132
            	Error:      	Received unexpected error:
            	            	unable to run diff-index pipeline in temporary repo: exec: canceling Cmd: invalid argument
            	Test:       	TestGetDiffPreview/empty_branch,_same_results
FAIL
```

pidfd_open is [documented](https://www.man7.org/linux/man-pages/man2/pidfd_open.2.html) to return the EINVAL (invalid argument) error if the pid is not valid, which could happen if the process terminates itself before Forgejo sends `SIGTERM`.  This PR adds a check for that error and stops `Cancel`, with a minor refactor to avoid code duplication.

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13293
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org>
2026-07-04 04:49:36 +02:00
limiting-factor
95db6ef377 chore(coverage): split integration coverage targets in two (#13168)
For debugging running `make coverage-run-sqlite` does not need to always run migration tests. Split the target so integration coverage can be called independently from migration coverage.

Add the `coverage-reset` target to dispose of previous coverage data that will interfere if the goal is to verify the coverage percentage, for instance.

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13168
Reviewed-by: Clouds <me@cloudsftp.de>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-07-04 03:07:17 +02:00
Clouds
c90d5b0336 chore(nilnil lint): resolve low-hanging fruit nilnil lint violations (#13230)
Some files excluded from the nilnil lint and listed in https://codeberg.org/forgejo/forgejo/issues/11261 contain no violations of the lint anymore. I removed them from the list. They are

- `routers/api/packages/container/auth.go`
- `routers/api/packages/nuget/auth.go`
- `routers/web/repo/setting/runners.go`
- `services/issue/commit.go`
- `services/migrations/onedev.go`

Other files contained lints that are triggered by returning `nil` for maps. This can be mitigated easily by returning `make(map[...]...)`. All except one of those return statements are already covered by tests. I list the ones that have coverage now, the statement that has no coverage was not changed.

### Tests for Go changes

- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13230
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-07-03 23:48:03 +02:00
OFHansen
26b2579afb feat(actions): add support for using workflow run-name as run title (#13114)
Enables the title of workflow runs to be defined from the `run-name` value in the workflow. This is the Forgejo side of the `run-name` implementation, started on forgejo/runner in PR [1575](https://code.forgejo.org/forgejo/runner/pulls/1575).

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.

- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [x] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [ ] I did not document these changes and I do not expect someone else to do it.

See docs PR [2020](https://codeberg.org/forgejo/docs/pulls/2020)

### Release notes

- [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- Features
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/13114): <!--number 13114 --><!--line 0 --><!--description ZmVhdChhY3Rpb25zKTogYWRkIHN1cHBvcnQgZm9yIHVzaW5nIHdvcmtmbG93IGBydW4tbmFtZWAgYXMgcnVuIHRpdGxl-->feat(actions): add support for using workflow `run-name` as run title<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: klausfyhn <klausfyhn@gmail.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13114
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-07-03 16:45:39 +02:00
limiting-factor
5b618cabd0 chore(documentation): explain the purpose of routers/api/v1/permissions (#13277)
Refs forgejo/design#63

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13277
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-07-03 04:58:02 +02:00
steven.guiheux
052b6ed8f5 fix: ignore migrated commit without a patch (#13257)
Close #13239

Implement the same behaviour as the gitea_uploader

### Tests for Go changes

(can be removed for JavaScript changes)

- I added test coverage for Go changes...
  - [X] in the `tests/integration` directory if it involves interactions with a live Forgejo server.

### Documentation

- [X] I did not document these changes and I do not expect someone else to do it.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13257
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-07-03 03:38:52 +02:00
Mathieu Fenniak
787aea6fa2 fix: restore Forgejo's capability to build on non-Linux UNIX platforms (#13289)
#13263 unintentionally prevents Forgejo from building on non-Linux UNIX OSes.  This PR adds a second graceful shutdown implementation which uses repeated signalling of the subprocess to detect if it is still running.  This additional implementation is used for non-Linux UNIX platforms.  It is also a fallback when Linux returns `ENOSYS` which should be the case in Linux kernels older than 5.3.

## Testing

- Validated build fails on a FreeBSD VM w/ head `forgejo`
    - `FreeBSD freebsd-test 15.1-RELEASE FreeBSD 15.1-RELEASE releng/15.1-n283562-96841ea08dcf GENERIC amd64`
- Validate build succeeds and process tests pass on FreeBSD VM w/ this branch:
    ```
    mfenniak@freebsd-test:~/Dev/forgejo $ GO_TEST_PACKAGES=forgejo.org/modules/process make test-backend
    Running go test with  -tags 'sqlite sqlite_unlock_notify'...
    ok  	forgejo.org/modules/process	5.690s
    ```
    - Note: other some other test modules do not pass like `forgejo.org/modules/log`, but this seems consistent with `forgejo` head.  As we don't have a baseline for expectations here, this isn't an issue that can be addressed in this PR.
- Fallback for pre-Linux 5.3 has been tested on a Debian Buster install, kernel 4.19.0, and confirmed `forgejo.org/modules/process` test success, and test failure without the fallback path.

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.
    - Adjustment to unreleased bugfix.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13289
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org>
2026-07-02 23:04:07 +02:00
Mathieu Fenniak
958cface13 fix: terminate git (& other) subcommands gracefully on context timeout/cancellation (#13263)
By default, when you create an `exec.CommandContext` in Go, when the context is cancelled or timed out, Go will SIGKILL the subprocess which does not allow the subprocess to perform any cleanup work.  As some git operations in Forgejo will be linked to the current HTTP context, and the current HTTP context will be closed when the HTTP client disconnects, this can theoretically cause SIGKILLs when locks are being held.

This PR contains two fixes:
- Change the behaviour of all subprocesses that Forgejo creates to use a graceful termination, SIGTERM'ing the process, and then SIGKILL'ing it after a timeout.
- Fixes a bug where previously all subprocesses are setup in a process group (by 1d04e8641d), but they were never *killed* in a process group, preventing child processes from receiving these termination signals.  Both SIGTERM and SIGKILL are sent to the process group.

Introduces new configuration setting which controls subcommand graceful timeouts.  If a subprocess does not shutdown from SIGTERM within `[server].SUBPROCESS_TERMINATE_GRACE` (default 5 seconds), then an error will be logged, and the process will be SIGKILL'd.  The error is:
```
2026/07/01 08:31:20 modules/log/init.go:38:func2() [E] Subprocess pid=3790963 (/nix/store/c0277k5giric1mn9dklllavbzvxl6hzb-git-2.53.0/bin/git blame --porcelain 8ee7e7c32b -- options/locale/locale_en-US.ini) failed to terminate from SIGTERM after grace period 0s, and was sent SIGKILL. The subprocess termination may leave incomplete state on the server, such as lock files. `[server].SUBPROCESS_TERMINATE_GRACE` can be changed to give subprocesses more time to cleanly exit.
```

(This was produced on a live server by setting SUBPROCESS_TERMINATE_GRACE to zero seconds, loading a page that does a `git blame`, and hitting escape in the browser quickly.)

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
    - Will create a documentation PR with new config settings.
- [ ] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13263
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org>
2026-07-01 20:26:02 +02:00
limiting-factor
d883bd8f12 chore(docs): clarify the bootstrap fatal error message displayed when no config is found (#13268)
Refs forgejo/forgejo#5445

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13268
Reviewed-by: Otto <otto@codeberg.org>
2026-07-01 15:59:39 +02:00
Mathieu Fenniak
16793050ce chore: add permissions.Context methods to lint-single-response (#13234)
#13087 added a new lint, `lint-single-response`, which guarantees that web handlers don't proceed after making a terminating call (eg. `ctx.Error(...)`).  #12512 introduced a new type with these terminating-style methods on the interface `forgejo.org/routers/api/v1/permissions.Context`.  This PR adds the new methods to the list of terminating calls.

## Testing

In addition to automated tests which check the usage, I've manually altered codepaths in `routers/api/v1` and removed `return` statements (for example, removing [this line](1ab4c8d915/routers/api/v1/permissions/req_admin.go (L18))), and then running `make lint-single-response`:
```
$ make lint-single-response
.../go/pkg/mod/golang.org/toolchain@v0.0.1-go1.26.4.linux-amd64/bin/go run ./build/lint-single-response/cmd ./...
.../Dev/forgejo/routers/api/v1/permissions/req_admin.go:17:3: Invocation of forgejo.org/routers/api/v1/permissions.Context / NotFound, and control flow continues afterwards.
exit status 3
make: *** [Makefile:535: lint-single-response] Error 1
```

This testing was important because `permissions.Context` is the first interface to be involved in this new lint, where the other usages are all structs.

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13234
Reviewed-by: limiting-factor <limiting-factor@noreply.codeberg.org>
2026-07-01 15:41:04 +02:00
Andreas Ahlenstorf
85d38e354d fix: ensure runners either belong to owner or repo when updated (#13262)
A runner can either belong to an owner (user, organization) or a repository, not both. While `CreateRunner()` enforces that, `UpdateRunner()` does not, which leads to bugs. With this change, `UpdateRunner()` rejects runners that have _both_ fields set to prevent unexpected ownership changes.

Resolves https://codeberg.org/forgejo/forgejo/issues/12106 and makes https://codeberg.org/forgejo/forgejo/pulls/12117 obsolete.

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13262
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-07-01 03:49:07 +02:00
Renovate Bot
0d8f6cac58 Update dependency globals to v17.7.0 (forgejo) (#13251) 2026-07-01 00:19:08 +02:00
limiting-factor
8ee7e7c32b fix(ui): in the admin config panel do not report a cache taking more than 100 microseconds as slow (#13256)
There is no absolute threshold to decide a cache is slow. Report the time it took to run the test and let the user decide if this is too slow or not.

Closes forgejo/forgejo#5846

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13256
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2026-06-30 12:06:06 +02:00
Renovate Bot
327cbada8a Update module github.com/go-chi/chi/v5 to v5.3.0 (forgejo) (#12697)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12697
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-29 23:35:12 +02:00
Renovate Bot
b6e77e9833 Update dependency webpack to v5.108.1 (forgejo) (#13244)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13244
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-29 22:20:11 +02:00
Renovate Bot
749ce89104 Update forgejo/forgejo-build-publish to v5.7.2 (forgejo) (#13008)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13008
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-29 21:42:45 +02:00
Renovate Bot
384f8e5719 Update https://data.forgejo.org/actions/cache action to v6 (forgejo) (#13247)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13247
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-29 20:53:44 +02:00
Renovate Bot
7bc9fe64a9 Update dependency asciinema-player to v3.16.0 (forgejo) (#13233)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13233
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-29 20:32:44 +02:00
Renovate Bot
57efa069b0 Update dependency license-checker-rseidelsohn to v5 (forgejo) (#13246)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13246
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-29 20:28:35 +02:00
Renovate Bot
79b64728ae Update dependency webpack-cli to v7.1.0 (forgejo) (#13245)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13245
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-29 20:14:57 +02:00
Renovate Bot
e05a36a2ba Update dependency tom-select to v2.6.1 (forgejo) (#13243)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13243
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-29 19:36:47 +02:00
Marcel
7e5ca3bdeb fix: check valid commit ids for existence (#12963)
When downloading archives Forgejo uses git cat-file to resolve a ref name (e.g. branch or tag) to a commit id. There were a check if the input already was a valid full commit id, sadly without a check if the commit exists. Therefore, I removed this "early return".

I noticed this while trying to download archives from Codeberg and the there was just a timeout after 10min. Upon trying this on a self-hosted instance I saw the error in the logs, which led me to his fix.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12963
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-29 17:21:55 +02:00
Renovate Bot
69fc0e06d9 Update renovate (forgejo) (#13231) 2026-06-29 16:22:05 +02:00
Mathieu Fenniak
fd286904b9 chore: fix compile errors from merge of #13151 (#13235)
Merged #13151 w/ green status checks and no direct conflicts, but indirect compile conflicts caused [build errors](https://codeberg.org/forgejo/forgejo/actions/runs/173248/jobs/0/attempt/1).  This PR fixes those errors.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13235
Reviewed-by: crystal <crystal@noreply.codeberg.org>
2026-06-29 08:17:46 +02:00
limiting-factor
a3fa6fe41d chore: add coverage for REST API fork destination permission check (#13151)
- extract permission check from `routers/api/v1/repo/fork.go` into the `checkForkDestination()` middleware with no functional change
- add the `checkForkDestination()` middleware to the `CreateFork` route
- add test scenarios covering `checkForkDestination()`, except for unrecoverable errors

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13151
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-06-29 04:04:16 +02:00
limiting-factor
a48683f064 feat: add internal APIs for reactions notifications (#13017)
- add the NewReaction and DeleteReaction interface and loop to the
  notify service
- use services/issue instead of models/issues in REST and web API to
  create and delete reactions
- Issues and Comment reactions created via services/issue notify via NewReaction
- Issues and Comment reactions deleted via services/issue notify via DeleteReaction

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13017
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-06-29 03:59:39 +02:00
birdgoose
1ab4c8d915 fix(ui): fix HTMX attributes in watch, star, and notification buttons (#12976)
Fixes forgejo/forgejo#12951

The changes are made to the following template files:
- on the repo star/unstar button
- on the repo watch/unwatch button
- on the issue notification button

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12976
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2026-06-28 18:00:15 +02:00
Renovate Bot
309b365bd3 Update CodeMirror (forgejo) (#13222)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13222
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-28 14:13:25 +02:00
Renovate Bot
6bbcaeae04 Update actions/cache (forgejo) (#13223)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13223
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-28 12:45:21 +02:00
Renovate Bot
9b8c9c9c53 Update dependency swagger-ui-dist to v5.32.8 (forgejo) (#13199)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13199
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-27 23:43:05 +02:00
Markus Unterwaditzer
d464d625d8 feat: Move repo topic selector to tom-select (#12736)
This is a proof of concept for replacing Formatic's buggy dropdown with
something else. There are a bunch of open gitea issues on github
discussing getting rid of Fomantic.

Tested in Firefox/Chrome. Attached screenshots are before/after. The one with the input focused in orange, and tighter letter spacing, is after.

If this is merged I plan to move the other selectors off of Fomantic.

Alternative to https://codeberg.org/forgejo/forgejo/pulls/12731, also fixes #10118

Signed-off-by: Markus Unterwaditzer <markus-tarpit+git@unterwaditzer.net>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12736
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-27 23:30:59 +02:00
limiting-factor
423b6cb589 chore(refactor): remove GetX redundant accessors and use X in services/context/api.go (#13215)
Followup of the refactor adding setter/getter to APIContext  https://codeberg.org/forgejo/forgejo/pulls/13143

- Only has an impact on the getters used by `routers/api/v1/permissions`
- When GetX and X both exist, remove GetX
- When GetX exists and X does not, rename GetX to X
- GetOrg is an exception as it would conflict with Org and is renamed Organization. This is due to APIContext having its own Org structure that includes an Organization.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13215
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-06-27 18:34:52 +02:00
limiting-factor
fa96d5eed2 fix(ci): allow for empty redis passwords in the coverage.yml workflow (#13169)
Can be reproduced by triggering the coverage workflow from the forgejo branch ([sample failed run](https://codeberg.org/forgejo/forgejo/actions/runs/171696/jobs/0/attempt/1#jobstep-5-70)). The service fails to run with:

```
redis 07:38:53.91 INFO  ==>
redis 07:38:53.92 INFO  ==> Welcome to the Bitnami redis container
redis 07:38:53.92 INFO  ==> Subscribe to project updates by watching https://github.com/bitnami/containers
redis 07:38:53.93 INFO  ==> Submit issues and feature requests at https://github.com/bitnami/containers/issues
redis 07:38:53.93 INFO  ==> Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit https://bitnami.com/enterprise
redis 07:38:53.94 INFO  ==>
redis 07:38:53.94 INFO  ==> ** Starting Redis setup **
redis 07:38:53.98 ERROR ==> The REDIS_PASSWORD environment variable is empty or not set. Set the environment variable ALLOW_EMPTY_PASSWORD=yes to allow the container to be started with blank passwords. This is recommended only for development.
```

It was fixed long ago in the testing.yml workflow:

df8d0cf9f2 * fix: redis & valkey images immediately shutdown

## Testing

- Launch a runner locally
- Trigger the coverage workflow
   ![image](/attachments/649dde36-e19d-428a-b7b1-b7ac5ecf1371)
- See that it succeeds ([sample run](https://codeberg.org/limiting-factor/forgejo/actions/runs/3))

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13169
Reviewed-by: Clouds <me@cloudsftp.de>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2026-06-27 18:17:40 +02:00
Renovate Bot
0d9527dd35 Update module github.com/caddyserver/certmagic to v0.25.4 (forgejo) (#13200)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13200
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-27 17:37:25 +02:00
limiting-factor
28f6c175b2 chore(refactor): add getter/setter to APIContext data members (#13143)
This is a followup pull request discussed originally at  https://codeberg.org/forgejo/forgejo/pulls/12512, to start work on aligning the `Context` interface to Go conventions of `X() & SetX()`, not `GetX() & SetX()`.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13143
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-06-27 02:53:45 +02:00
limiting-factor
60cd559bfc chore(docs): update test instructions in routers/api/v1/permissions/tests (#13167)
The tests are now run from the integration directory and the instructions were meant for when the tests ran from the package.

## Testing

- checkout the main forgejo branch
- run the commands from the root of the tree
- verify the output is as expected (see https://codeberg.org/forgejo/forgejo/pulls/13151 for examples)

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. All work and communication must conform to Forgejo's [AI Agreement](https://codeberg.org/forgejo/governance/src/branch/main/AIAgreement.md). There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13167
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-06-27 02:30:09 +02:00
Clouds
e847a11127 chore: bump golangci-lint version (#13211)
As described in https://codeberg.org/forgejo/forgejo/issues/13205, golangci-lint introduced a new linting rule related to iterating over slices in reverse. This PR updates golangci-lint to the newest otherwise functioning version (v2.12.1) and makes all code compliant with the newly introduced rule.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13211
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-27 00:35:03 +02:00
Mathieu Fenniak
9b40db2aa4 fix: prevent server error when multiple runners fetch same job concurrently on MariaDB 11.8+ (#13204)
#12768 added a test `TestCreateTaskForRunnerNoJobUpdated` which has been failing on MariaDB 11.8 in integration-testing.  As a fix here, the error occurring (which xorm [recognizes as an `ErrDeadlock`](9eb644730c/dialects/mysql.go (L961-L972))) is treated the same as having zero records updated, and the test case then passes in MariaDB 11.8.

There is no real-world report of "server error when multiple runners fetch same job on MariaDB 11.8+", but it is the expected failure that would occur in production, rarely, that this test failure highlights.

### Tests for Go changes

- I added test coverage for Go changes...
  - [ ] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
  - **Already present and failing**
- I ran...
  - [x] `make pr-go` before pushing

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13204
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org>
2026-06-26 14:55:06 +02:00
Benedek Kozma
939e5e8b0a fix: Update swift package registry to use the metadata schema from the official Swift docs (#12200)
fixes #12108

docs PR: https://codeberg.org/forgejo/docs/pulls/1893

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [x] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [ ] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

*The decision if the pull request will be shown in the release notes is up to the mergers / release team.*

The content of the `release-notes/<pull request number>.md` file will serve as the basis for the release notes. If the file does not exist, the title of the pull request will be used instead.

## Testing

Related PRs:

- https://code.forgejo.org/forgejo/end-to-end/pulls/2063
- https://code.forgejo.org/forgejo/oci-mirror/pulls/69

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12200
Reviewed-by: limiting-factor <limiting-factor@noreply.codeberg.org>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-06-26 04:25:56 +02:00
Clouds
221bcd11c5 chore(services/actions/{trust,context}.go): increase coverage of mustGetIssuePoster and enable nilnil lint (#13150)
Increases the coverage of and simplifies `mustGetIssuePoster` in `services/actions/trust.go`. Also enables the nilnil lint for `services/actions/trust.go` and `services/actions/context.go`

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [x] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13150
Reviewed-by: limiting-factor <limiting-factor@noreply.codeberg.org>
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
2026-06-26 00:48:12 +02:00
Dylan Hackworth
8ca338754d feat: Add 'Copy Markdown' button (#13083)
This pull request adds a "Copy Markdown" button to issue comments.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13083
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-25 15:40:50 +02:00
Renovate Bot
2e333d1a4e Update dependency esbuild-loader to v4.5.0 (forgejo) (#13133)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13133
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-25 14:48:57 +02:00
Mathieu Fenniak
a9a598d4b8 fix: ensure migrations allow/deny host lists are applied to onedev, pagure, and codebase migrators (#13184)
Similar to #13129, fixing a few places where `[migrations].ALLOWED_DOMAINS`, `...BLOCKED_DOMAINS`, and `...ALLOW_LOCALNETWORKS` are not implemented in external migrations, creating SSRF risks.

### Tests for Go changes

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I ran...
  - [x] `make pr-go` before pushing

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change.
- [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13184
Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org>
2026-06-25 14:11:36 +02:00
Renovate Bot
19a5039fe5 Update module github.com/mattn/go-sqlite3 to v1.14.47 (forgejo) (#13162)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13162
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2026-06-25 13:27:53 +02:00
0ko
8132ccd246 chore: run renovate on v16 branch (#13194)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/13194
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2026-06-25 07:48:23 +02:00
forgejo-release-manager
db53f0dc4c chore: 16.0.0 is now stable - first commit 2026-06-25 06:24:36 +02:00