Skip to content

Commit 574bdca

Browse files
committed
fmt issues
Signed-off-by: Diogenes Fernandes <diofeher@gmail.com>
1 parent e809336 commit 574bdca

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

github/data_source_github_actions_organization_remove_token.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func dataSourceGithubActionsOrganizationRemoveToken() *schema.Resource {
2828
}
2929
}
3030

31-
func dataSourceGithubActionsOrganizationRemoveTokenRead(d *schema.ResourceData, meta interface{}) error {
31+
func dataSourceGithubActionsOrganizationRemoveTokenRead(d *schema.ResourceData, meta any) error {
3232
client := meta.(*Owner).v3client
3333
owner := meta.(*Owner).name
3434

github/data_source_github_actions_remove_token.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import (
88
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
99
)
1010

11+
// dataSourceGithubActionsRemoveToken is a data source that creates a token that can be
12+
// used to remove a self-hosted runner from a repository.
13+
// https://docs.github.com/en/enterprise-cloud@latest/rest/actions/self-hosted-runners?apiVersion=2022-11-28#create-a-remove-token-for-a-repository
1114
func dataSourceGithubActionsRemoveToken() *schema.Resource {
1215
return &schema.Resource{
1316
Read: dataSourceGithubActionsRemoveTokenRead,
@@ -30,15 +33,15 @@ func dataSourceGithubActionsRemoveToken() *schema.Resource {
3033
}
3134
}
3235

33-
func dataSourceGithubActionsRemoveTokenRead(d *schema.ResourceData, meta interface{}) error {
36+
func dataSourceGithubActionsRemoveTokenRead(d *schema.ResourceData, meta any) error {
3437
client := meta.(*Owner).v3client
3538
owner := meta.(*Owner).name
3639
repoName := d.Get("repository").(string)
3740

3841
log.Printf("[DEBUG] Creating a GitHub Actions repository remove token for %s/%s", owner, repoName)
3942
token, _, err := client.Actions.CreateRemoveToken(context.TODO(), owner, repoName)
4043
if err != nil {
41-
return fmt.Errorf("error creating a GitHub Actions repository remove token for %s/%s: %s", owner, repoName, err)
44+
return fmt.Errorf("error creating a GitHub Actions repository remove token for %s/%s: %w", owner, repoName, err)
4245
}
4346

4447
d.SetId(fmt.Sprintf("%s/%s", owner, repoName))

github/resource_github_team.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,14 +328,14 @@ func resourceGithubTeamDelete(d *schema.ResourceData, meta any) error {
328328
ctx := context.WithValue(context.Background(), ctxId, d.Id())
329329

330330
_, err = client.Teams.DeleteTeamByID(ctx, orgId, id)
331-
/*
332-
When deleting a team and it failed, we need to check if it has already been deleted meanwhile.
333-
This could be the case when deleting nested teams via Terraform by looping through a module
334-
or resource and the parent team might have been deleted already. If the parent team had
335-
been deleted already (via parallel runs), the child team is also already gone (deleted by
336-
GitHub automatically).
337-
So we're checking if it still exists and if not, simply remove it from TF state.
338-
*/
331+
// When deleting a team and it failed, we need to check if it has already been deleted meanwhile.
332+
// This could be the case when deleting nested teams via Terraform by looping through a module
333+
// or resource and the parent team might have been deleted already. If the parent team had
334+
// been deleted already (via parallel runs), the child team is also already gone (deleted by
335+
// GitHub automatically).
336+
// So we're checking if it still exists and if not, simply remove it from TF state.
337+
//
338+
// https://docs.github.com/en/enterprise-cloud@latest/rest/teams/teams?apiVersion=2022-11-28#delete-a-team
339339
if err != nil {
340340
// Fetch the team in order to see if it exists or not (http 404)
341341
_, _, err = client.Teams.GetTeamByID(ctx, orgId, id)

0 commit comments

Comments
 (0)