diff options
author | Jason Song <i@wolfogre.com> | 2023-05-19 19:35:12 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-19 19:35:12 +0800 |
commit | 7985cde84df5ee93bfb37b20681d69e67d3f32fc (patch) | |
tree | d31146c7b3896330c93b5940d2339ef756daa0a5 /tests/integration/api_actions_artifact_test.go | |
parent | 3eecde3f3318eb6f600f651442e754d8f6691f03 (diff) | |
download | gitea-7985cde84df5ee93bfb37b20681d69e67d3f32fc.tar.gz gitea-7985cde84df5ee93bfb37b20681d69e67d3f32fc.zip |
Fix Actions being enabled accidentally (#24802)
Regression of #24536. If the user doesn't explicitly disable Actions, it
will be enabled.
1. Gitea will call `loadRepositoryFrom` before `loadActionsFrom`.
https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/setting.go#L234-L237
2. In `loadRepositoryFrom`,
`rootCfg.Section("actions").Key("ENABLED").MustBool(true)` will set
`actions.ENABLED` with `true`.
https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/repository.go#L313-L315
3. In `loadActionsFrom`, `rootCfg.Section("actions")` will get a section
with Actions enabled.
https://github.com/go-gitea/gitea/blob/25d4f95df25dae5226e96e813dde87b071d9155e/modules/setting/actions.go#L23-L26
Although the cause of the problem was using `true` by copy-paste
mistake, it also surprised me that
**`rootCfg.Section("actions").Key("ENABLED").MustBool(true)` doesn't
only read, but also write.**
Diffstat (limited to 'tests/integration/api_actions_artifact_test.go')
0 files changed, 0 insertions, 0 deletions