mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-12-08 06:29:47 +00:00
Identified in code review https://codeberg.org/forgejo/forgejo/pulls/10244#issuecomment-8576643, the `PreExecutionError` field in `ActionRun` isn't well implemented as it translates the error at action runtime rather than later when the action is viewed in the UI. This PR adds an error code and error details column that can be more correctly translated. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10267 Reviewed-by: 0ko <0ko@noreply.codeberg.org> Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net> Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
24 lines
631 B
Go
24 lines
631 B
Go
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package forgejo_migrations
|
|
|
|
import (
|
|
"xorm.io/xorm"
|
|
)
|
|
|
|
func init() {
|
|
registerMigration(&Migration{
|
|
Description: "add PreExecutionErrorCode & PreExecutionErrorDetails to action_run",
|
|
Upgrade: addActionRunPreExecutionErrorCode,
|
|
})
|
|
}
|
|
|
|
func addActionRunPreExecutionErrorCode(x *xorm.Engine) error {
|
|
type ActionRun struct {
|
|
PreExecutionErrorCode int64
|
|
PreExecutionErrorDetails []any `xorm:"JSON LONGTEXT"`
|
|
}
|
|
_, err := x.SyncWithOptions(xorm.SyncOptions{IgnoreDropIndices: true}, new(ActionRun))
|
|
return err
|
|
}
|