Skip to content

feat: add repo.actions unit support for teams #3

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/resources/team.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ resource "gitea_team" "test_team_restricted" {
Can be `none`, `read`, `write`, `admin` or `owner`
- `repositories` (List of String) List of Repositories that should be part of this team
- `units` (String) List of types of Repositories that should be allowed to be created from Team members.
Can be `repo.code`, `repo.issues`, `repo.ext_issues`, `repo.wiki`, `repo.pulls`, `repo.releases`, `repo.projects` and/or `repo.ext_wiki`
Can be `repo.code`, `repo.issues`, `repo.ext_issues`, `repo.wiki`, `repo.pulls`, `repo.releases`, `repo.projects`, `repo.ext_wiki` and/or `repo.actions`

### Read-Only

Expand Down
10 changes: 8 additions & 2 deletions gitea/resource_gitea_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ func resourceTeamCreate(d *schema.ResourceData, meta interface{}) (err error) {
if strings.Contains(d.Get(TeamUnits).(string), "repo.projects") {
units = append(units, gitea.RepoUnitProjects)
}
if strings.Contains(d.Get(TeamUnits).(string), "repo.actions") {
units = append(units, gitea.RepoUnitActions)
}

includeAllRepos := d.Get(TeamIncludeAllReposFlag).(bool)

Expand Down Expand Up @@ -153,6 +156,9 @@ func resourceTeamUpdate(d *schema.ResourceData, meta interface{}) (err error) {
if strings.Contains(d.Get(TeamUnits).(string), "repo.projects") {
units = append(units, gitea.RepoUnitProjects)
}
if strings.Contains(d.Get(TeamUnits).(string), "repo.actions") {
units = append(units, gitea.RepoUnitActions)
}

opts := gitea.EditTeamOption{
Name: d.Get(TeamName).(string),
Expand Down Expand Up @@ -277,9 +283,9 @@ func resourceGiteaTeam() *schema.Resource {
Type: schema.TypeString,
Required: false,
Optional: true,
Default: "[repo.code, repo.issues, repo.ext_issues, repo.wiki, repo.pulls, repo.releases, repo.projects, repo.ext_wiki]",
Default: "[repo.code, repo.issues, repo.ext_issues, repo.wiki, repo.pulls, repo.releases, repo.projects, repo.ext_wiki, repo.actions]",
Description: "List of types of Repositories that should be allowed to be created from Team members.\n" +
"Can be `repo.code`, `repo.issues`, `repo.ext_issues`, `repo.wiki`, `repo.pulls`, `repo.releases`, `repo.projects` and/or `repo.ext_wiki`",
"Can be `repo.code`, `repo.issues`, `repo.ext_issues`, `repo.wiki`, `repo.pulls`, `repo.releases`, `repo.projects`, `repo.ext_wiki` and/or `repo.actions`",
},
"repositories": {
Type: schema.TypeList,
Expand Down