Bulk enable actions / enable actions by default #10524

Closed
opened 2025-11-02 09:10:14 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @cthu1hoo on GitHub (Mar 26, 2023).

Feature Description

I need to enable actions for a large-ish amount of repositories. Is there a way to do that without clicking in the UI, e.g. through the API? I went through the demo API page but didn't find anything relevant.

Possibly related, it would also be great to have an organization setting to enable actions by default on any child repositories.

Thanks in advance for considering. Actions, even in the current somewhat unfinished state, are really great. I was waiting for native Gitea CI for a very long time. :)

Screenshots

No response

Originally created by @cthu1hoo on GitHub (Mar 26, 2023). ### Feature Description I need to enable actions for a large-ish amount of repositories. Is there a way to do that without clicking in the UI, e.g. through the API? I went through the demo API page but didn't find anything relevant. Possibly related, it would also be great to have an organization setting to enable actions by default on any child repositories. Thanks in advance for considering. Actions, even in the current somewhat unfinished state, are really great. I was waiting for native Gitea CI for a very long time. :) ### Screenshots _No response_
GiteaMirror added the topic/gitea-actionstype/proposaltype/feature labels 2025-11-02 09:10:14 -06:00
Author
Owner

@jaydouble commented on GitHub (Aug 31, 2023):

For the time being a bash script with the use of sqlite:

export db=gitea/gitea/gitea.db 
sqlite3 $db "select id from repository;" | \
    while read repoid; \
    do \
        [ "$(sqlite3 $db "select * from repo_unit where repo_id=$repoid and type=10")" == "" ] && \
        sqlite3 $db "INSERT INTO repo_unit VALUES (null,$repoid,10,null,$(date +%s));"; \
    done

Review this script first if it fits your needs.
It will enable it on all repos without warnings.

It worked on my simple gitea server, but it maybe not working on yours.

But it will maybe give an direction how to enable actions for your repos.

disclaimer: i'm not responsible for breaking your system.

@jaydouble commented on GitHub (Aug 31, 2023): For the time being a bash script with the use of sqlite: ``` export db=gitea/gitea/gitea.db sqlite3 $db "select id from repository;" | \ while read repoid; \ do \ [ "$(sqlite3 $db "select * from repo_unit where repo_id=$repoid and type=10")" == "" ] && \ sqlite3 $db "INSERT INTO repo_unit VALUES (null,$repoid,10,null,$(date +%s));"; \ done ``` Review this script first if it fits your needs. It will enable it on all repos without warnings. It worked on my simple gitea server, but it maybe not working on yours. But it will maybe give an direction how to enable actions for your repos. disclaimer: i'm not responsible for breaking your system.
Author
Owner

@jaydouble commented on GitHub (Sep 11, 2023):

Updated version, just sql:

INSERT INTO repo_unit (repo_id,type,config,created_unix)
SELECT distinct(repo_id), "10", null, UNIX_TIMESTAMP() from repo_unit
where repo_id in (SELECT id from repository) 
AND repo_id not in (SELECT repo_id from repo_unit where type=10);
@jaydouble commented on GitHub (Sep 11, 2023): Updated version, just sql: ```mysql INSERT INTO repo_unit (repo_id,type,config,created_unix) SELECT distinct(repo_id), "10", null, UNIX_TIMESTAMP() from repo_unit where repo_id in (SELECT id from repository) AND repo_id not in (SELECT repo_id from repo_unit where type=10); ```
Author
Owner

@lunny commented on GitHub (Sep 20, 2023):

The actions now was enabled by #27054 and you can update repository to enable actions via API. You can find it at https://docs.gitea.com/api/next/#tag/repository/operation/repoEdit and has_actions.
I think this could be closed now.

@lunny commented on GitHub (Sep 20, 2023): The actions now was enabled by #27054 and you can update repository to enable actions via API. You can find it at https://docs.gitea.com/api/next/#tag/repository/operation/repoEdit and `has_actions`. I think this could be closed now.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10524