forgejo/models
Andreas Ahlenstorf 1127aca2d2 fix: set attempt number of action run jobs eagerly (#11750)
A Forgejo Action job should be uniquely identifiable by its `ID` and `Attempt` number. Each time a particular job is (re-)run, its `Attempt` number is incremented while its `ID` remains static. Unfortunately, `Attempt` is not incremented when the (re-)run is triggered, but right when Forgejo Runner requests the job. That makes identifying a particular run much harder, because the attempt number is changed in the midst of an attempt. Furthermore, it requires taking the job's `Status` into account. This is fixed by setting the correct attempt number right when a (re-)run is triggered. That means that the `Attempt` number remains static for the duration of a single attempt.

## 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

### Tests for JavaScript changes

(can be removed for Go changes)

- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] 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

- [ ] 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.

*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.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11750
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
Co-authored-by: Andreas Ahlenstorf <andreas@ahlenstorf.ch>
Co-committed-by: Andreas Ahlenstorf <andreas@ahlenstorf.ch>
2026-03-20 17:23:09 +01:00
..
actions fix: set attempt number of action run jobs eagerly (#11750) 2026-03-20 17:23:09 +01:00
activities chore: move all test blank imports in a single package (#10662) 2026-01-02 05:32:32 +01:00
admin feat: cache derived keys for faster keying (#10114) 2025-11-16 14:29:14 +01:00
asymkey chore: fix typos throughout the codebase (#10753) 2026-01-26 22:57:33 +01:00
auth feat: read, create, & delete repo-specific access tokens via API (#11504) 2026-03-07 21:55:08 +01:00
avatars feat(perf): remove unused size url parameter for local avatars (#10932) 2026-01-20 04:59:15 +01:00
db chore: support Option[T] as a type on database schema structs (#11553) 2026-03-08 03:36:32 +01:00
dbfs fix: garbage collect lingering actions logs (#10009) 2025-11-18 18:59:01 +01:00
fixtures feat: add more filters to actions run and tasks api (#11584) 2026-03-10 01:20:00 +01:00
forgefed log instrumentation & test package (#10371) 2025-12-09 15:37:50 +01:00
forgejo/semver chore: move all test blank imports in a single package (#10662) 2026-01-02 05:32:32 +01:00
forgejo_migrations chore: add comment for ap migration (#11144) 2026-03-09 17:09:07 +01:00
forgejo_migrations_legacy fix: normalize secrets consistently, display accurate help (#11052) 2026-02-09 17:02:18 +01:00
git refactor: replace Value() from Option[T] with Get() & ValueOrZeroValue() (#11218) 2026-02-10 16:41:21 +01:00
gitea_migrations ci: detect and prevent empty case statements in Go code (#11593) 2026-03-10 02:50:28 +01:00
issues fix: check that attachments belong to correct resource 2026-03-06 11:21:07 -07:00
moderation feat: render a link to poster profile next to the ID within shadow copy details (#10194) 2025-12-09 15:19:10 +01:00
organization fix: add missing deleting beans for organizations (#11699) 2026-03-17 09:11:52 +01:00
packages ci: detect and prevent empty case statements in Go code (#11593) 2026-03-10 02:50:28 +01:00
perm feat: add GetUserRepoPermissionWithReducer 2026-02-27 17:17:29 +01:00
project chore: add unit tests 2026-03-06 11:21:07 -07:00
pull fix: do not ignore automerge while a PR is checking for conflicts (#8189) 2025-06-17 10:58:07 +02:00
quota chore: move all test blank imports in a single package (#10662) 2026-01-02 05:32:32 +01:00
repo perf: remove redundant & incorrect filters on 'SearchRepoOptions.OwnerID' (#11729) 2026-03-18 17:01:44 +01:00
secret fix: normalize secrets consistently, display accurate help (#11052) 2026-02-09 17:02:18 +01:00
shared/types chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
system chore: move all test blank imports in a single package (#10662) 2026-01-02 05:32:32 +01:00
unit chore: do not leak global repository unit defaults (#11470) 2026-03-07 02:03:22 +01:00
unittest fix: prevent panic on gitlab import (releases/issues) (#11282) 2026-03-03 21:36:14 +01:00
user fix: UserTypeRemoteUser is an eligible organization member (#11326) 2026-02-17 02:39:46 +01:00
webhook refactor: replace Value() from Option[T] with Get() & ValueOrZeroValue() (#11218) 2026-02-10 16:41:21 +01:00
error.go fix: don't allow credentials in migrate/push mirror URL 2025-08-30 08:07:23 +02:00
main_test.go chore: move all test blank imports in a single package (#10662) 2026-01-02 05:32:32 +01:00
org.go chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
org_team.go chore: split AddRepository and AddTeamMember to return the inserted value (#11342) 2026-03-11 03:40:32 +01:00
org_team_test.go chore: split AddRepository and AddTeamMember to return the inserted value (#11342) 2026-03-11 03:40:32 +01:00
org_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repo.go fix: possible cause of invalid issue counts; cache invalidation occurs before a active transaction is committed (#10130) 2025-11-17 01:07:29 +01:00
repo_test.go Update module github.com/golangci/golangci-lint/cmd/golangci-lint to v2 (forgejo) (#7367) 2025-03-28 22:22:21 +00:00
repo_transfer.go chore: fix typos throughout the codebase (#10753) 2026-01-26 22:57:33 +01:00
repo_transfer_test.go chore: fix typos throughout the codebase (#10753) 2026-01-26 22:57:33 +01:00