Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Actions being enabled accidentally (#24802) #24810

Merged
merged 1 commit into from
May 19, 2023

Commits on May 19, 2023

  1. Fix Actions being enabled accidentally (go-gitea#24802)

    Regression of go-gitea#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.**
    wolfogre authored and GiteaBot committed May 19, 2023
    Configuration menu
    Copy the full SHA
    8953a07 View commit details
    Browse the repository at this point in the history