mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 12:15:43 +01:00
Backport #30331 by @yp05327 Fix #30243 We only checking unit disabled when detecting workflows, but not in runner `FetchTask`. So if a workflow was detected when action unit is enabled, but disabled later, `FetchTask` will still return these detected actions. Global setting: repo.ENABLED and repository.`DISABLED_REPO_UNITS` will not effect this. Co-authored-by: yp05327 <576951401@qq.com> (cherry picked from commit 52bdeb4d45d44756e28dda7f3f899bb57eed1aad)
This commit is contained in:
parent
7dfe3fe2cb
commit
fb028c37b5
1 changed files with 4 additions and 1 deletions
|
@ -11,6 +11,7 @@ import (
|
||||||
|
|
||||||
auth_model "code.gitea.io/gitea/models/auth"
|
auth_model "code.gitea.io/gitea/models/auth"
|
||||||
"code.gitea.io/gitea/models/db"
|
"code.gitea.io/gitea/models/db"
|
||||||
|
"code.gitea.io/gitea/models/unit"
|
||||||
"code.gitea.io/gitea/modules/container"
|
"code.gitea.io/gitea/modules/container"
|
||||||
"code.gitea.io/gitea/modules/log"
|
"code.gitea.io/gitea/modules/log"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
@ -227,7 +228,9 @@ func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask
|
||||||
if runner.RepoID != 0 {
|
if runner.RepoID != 0 {
|
||||||
jobCond = builder.Eq{"repo_id": runner.RepoID}
|
jobCond = builder.Eq{"repo_id": runner.RepoID}
|
||||||
} else if runner.OwnerID != 0 {
|
} else if runner.OwnerID != 0 {
|
||||||
jobCond = builder.In("repo_id", builder.Select("id").From("repository").Where(builder.Eq{"owner_id": runner.OwnerID}))
|
jobCond = builder.In("repo_id", builder.Select("id").From("repository").
|
||||||
|
Join("INNER", "repo_unit", "`repository`.id = `repo_unit`.repo_id").
|
||||||
|
Where(builder.Eq{"`repository`.owner_id": runner.OwnerID, "`repo_unit`.type": unit.TypeActions}))
|
||||||
}
|
}
|
||||||
if jobCond.IsValid() {
|
if jobCond.IsValid() {
|
||||||
jobCond = builder.In("run_id", builder.Select("id").From("action_run").Where(jobCond))
|
jobCond = builder.In("run_id", builder.Select("id").From("action_run").Where(jobCond))
|
||||||
|
|
Loading…
Reference in a new issue