forgejo/routers/api/actions
Mathieu Fenniak a012b8bf36 refactor: replace ActionRunnerToken.OwnerID & RepoID with optional.Option[int64] (#11601)
Currently:
- In the database, `NULL` is used in `action_runner_token.owner_id` & `.repo_id` to represent an absent value, as required by the foreign key
- In the code, `0` is used in `ActionRunnerToken.OwnerID` and `.RepoID` to represent an absent value

This PR replaces the `int64` fields with `optional.Option[int64]` which allows a single data type to be used for both cases, and removes the usage of the value `0` as a placeholder.

This change has a limited scope -- although `ActionRunnerToken` uses `NULL` values in the database, the related table `ActionRunner` still uses zero-values for `OwnerID` and `RepoID`.  This means a lot of code interacting with both of these tables still uses `0` values, such as the UI.  The changes here were stopped at a reasonable point to avoid cascading into all places that use the `ActionRunner` table.  (I'll continue this work in the future to enable foreign keys on `ActionRunner`, but likely after #11516 is completed to avoid serious conflict resolution problems.)

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. 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).

### Tests for Go changes

(can be removed for JavaScript 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/11601
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2026-03-10 03:19:16 +01:00
..
ping chore: use code.forgejo.org/forgejo/actions-proto (#9981) 2025-11-05 16:10:52 +01:00
runner refactor: replace ActionRunnerToken.OwnerID & RepoID with optional.Option[int64] (#11601) 2026-03-10 03:19:16 +01:00
actions.go feat: add OIDC workload identity federation support (#10481) 2026-01-15 03:39:00 +01:00
artifact.pb.go Actions Artifacts v4 backend (#28965) 2024-03-06 12:10:45 +08:00
artifact.proto Actions Artifacts v4 backend (#28965) 2024-03-06 12:10:45 +08:00
artifacts.go chore: fix typos throughout the codebase (#10753) 2026-01-26 22:57:33 +01:00
artifacts_chunks.go chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
artifacts_utils.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
artifactsv4.go chore: fix typos throughout the codebase (#10753) 2026-01-26 22:57:33 +01:00
id_token.go chore: Add JWT() method for convenience and clarity (#11067) 2026-02-07 01:01:30 +01:00
oidc.go feat: add OIDC workload identity federation support (#10481) 2026-01-15 03:39:00 +01:00