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

Update to 6.2.1 from upstream #14

Merged
merged 49 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
47c3d36
Make resource repository_deploy_key read_only a bool, and expand the …
rwblokzijl Jan 19, 2024
dbda378
Add prevent_self_review parameter to the github_repository_environmen…
Nmishin Jan 19, 2024
6e507a6
fix: github_rest_api data source always returns header and body as nu…
srgustafson8 Jan 22, 2024
8e61a74
build(deps): bump github.com/google/uuid from 1.5.0 to 1.6.0
dependabot[bot] Jan 29, 2024
86b20f2
build(deps): bump peter-evans/create-or-update-comment from 3 to 4
dependabot[bot] Jan 29, 2024
378d451
build(deps): bump peter-evans/create-or-update-comment from 3 to 4
nickfloyd Feb 1, 2024
ddb0c3b
build(deps): bump github.com/google/uuid from 1.5.0 to 1.6.0
nickfloyd Feb 1, 2024
970dd20
Add support for packages IP ranges in github_ip_ranges (#1958)
Nmishin Feb 2, 2024
9008816
fix(resource_github_release): Handle missing release in read (#2115)
arunsathiya Feb 5, 2024
414299f
docs: update commit_message arg desc for repository_file resource (#2…
manjinder-mckc Feb 5, 2024
b4235f7
fix doc for #2054: Clarify how allows_force_pushes is working
bpaquet Feb 7, 2024
ee40a30
Improve doc
bpaquet Feb 7, 2024
5de1f37
Fix
bpaquet Feb 7, 2024
7be79c4
Fix
bpaquet Feb 7, 2024
b28bf62
build(deps): bump golang.org/x/oauth2 from 0.16.0 to 0.17.0
dependabot[bot] Feb 12, 2024
684398f
build(deps): bump golang.org/x/oauth2 from 0.16.0 to 0.17.0
nickfloyd Feb 12, 2024
3eb0fbd
docs: Correct name of docs file (#2138)
grahamhar Feb 12, 2024
2d31318
docs: Clarify how allows_force_pushes works
nickfloyd Feb 13, 2024
16872b7
v6 (#2091)
kfcampbell Feb 16, 2024
bf5403d
build(deps): bump github.com/golangci/golangci-lint (#2159)
dependabot[bot] Feb 20, 2024
ceadb68
build(deps): bump github.com/hashicorp/terraform-plugin-sdk/v2 (#2160)
dependabot[bot] Feb 20, 2024
5d790cb
build(deps): bump github.com/hashicorp/terraform-plugin-sdk/v2
dependabot[bot] Feb 26, 2024
d552d76
Update example usage to use version 6.0
rnestler Feb 27, 2024
ba93d48
Fix github_external_groups page title
tomasmota Feb 27, 2024
ca7938e
build(deps): bump github.com/hashicorp/terraform-plugin-sdk/v2 from 2…
nickfloyd Feb 27, 2024
e7b3083
Merge branch 'main' into main
nickfloyd Feb 27, 2024
7e0d468
docs: Fix github_external_groups page title
nickfloyd Feb 27, 2024
3f27927
docs: Update example usage to use version 6.0
nickfloyd Feb 27, 2024
97d5113
fix: Use desired state for determining actions config (#2114)
Danielku15 Mar 4, 2024
4ca9b21
GitHub org ignore archived repos (#1833)
felixlut Mar 4, 2024
3859526
build(deps): bump github.com/stretchr/testify from 1.8.4 to 1.9.0 (#2…
dependabot[bot] Mar 4, 2024
4eabe92
build(deps): bump golang.org/x/crypto from 0.19.0 to 0.21.0 (#2180)
dependabot[bot] Mar 4, 2024
b9af9f3
build(deps): bump actions/add-to-project from 0.5.0 to 0.6.0 (#2175)
dependabot[bot] Mar 4, 2024
a69c6f0
fix: validation to allow 1000 results per page (#2185)
dschniepp Mar 7, 2024
480825c
fix: Prevent loading of allowed actions if not configured (#2186)
Danielku15 Mar 8, 2024
39c5e06
fix(data_source_github_rest_api): only allow for 404 on err (#2154)
riezebosch Mar 8, 2024
4cebab8
fix: error if autolink reference not found (#2164)
bradam12 Mar 8, 2024
52e1853
feat: Add `github_actions_enterprise_permissions` (#2155)
ErikElkins Mar 8, 2024
dd57a50
docs: configure release notes categories based on labels (#2184)
laughedelic Mar 8, 2024
30e6176
build(deps): bump golang.org/x/oauth2 from 0.17.0 to 0.18.0 (#2189)
dependabot[bot] Mar 11, 2024
af693fd
fix(data_source_github_rest_api): store raw body in state (#2152)
riezebosch Mar 12, 2024
5e090bc
build(deps): bump google.golang.org/protobuf from 1.32.0 to 1.33.0 (#…
dependabot[bot] Mar 14, 2024
b1243e4
feat: `add github_enterprise_actions_runner_group` (#2158)
bradam12 Mar 18, 2024
84e8d55
Feat: Fixes abandoned PR #2017: Add support for the require_last_push…
georgekaz Mar 18, 2024
4c8424f
build(deps): bump actions/add-to-project from 0.6.0 to 0.6.1 (#2210)
dependabot[bot] Mar 25, 2024
0ff85ac
build(deps): bump github.com/golangci/golangci-lint (#2209)
dependabot[bot] Mar 25, 2024
e3d487b
chore(actions_runner_group): fix missing schema id (#2195)
EttoreFoti Mar 25, 2024
e1f5feb
chore(organization_webhook): fix insecure_ssl (#2196)
EttoreFoti Mar 25, 2024
49d1f2e
Merge tag 'refs/tags/v5.45.0-fl.1' into update-6.2.1
snovikov Jun 12, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
34 changes: 34 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes

changelog:
categories:
- title: 💥 Breaking Changes
labels:
- "Type: Breaking change"

- title: 🚀 New Features
labels:
- "Type: Feature"
- "New data source"
- "New resource"

- title: 🐛 Bugfixes
labels:
- "Type: Bug"

- title: 🪦 Deprecations
labels:
- "Deprecation"

- title: 🛠️ Maintenance
labels:
- "Type: Maintenance"
- "dependencies"

- title: 📝 Documentation
labels:
- "Type: Documentation"

- title: 🏷 Other Changes
labels:
- "*"
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
ci:
runs-on: ubuntu-latest
env:
GITHUB_TEST_ORGANIZATION: 'kfcampbell-terraform-provider'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/immediate-response.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: echo "NUMBER=${{ github.event.issue.number || github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"

- name: Respond to issue or PR
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.extract.outputs.NUMBER }}
body: >
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ linters:

linters-settings:
errcheck:
ignore: github.com/hashicorp/terraform-plugin-sdk/helper/schema:ForceNew|Set,fmt:.*,io:Close
ignore: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set,fmt:.*,io:Close

20 changes: 14 additions & 6 deletions github/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"time"

"github.com/google/go-github/v57/github"
"github.com/hashicorp/terraform-plugin-sdk/helper/logging"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging"
"github.com/shurcooL/githubv4"
"golang.org/x/oauth2"
)
Expand All @@ -21,6 +21,9 @@ type Config struct {
Insecure bool
WriteDelay time.Duration
ReadDelay time.Duration
RetryDelay time.Duration
RetryableErrors map[int]bool
MaxRetries int
ParallelRequests bool
}

Expand All @@ -33,16 +36,20 @@ type Owner struct {
IsOrganization bool
}

func RateLimitedHTTPClient(client *http.Client, writeDelay time.Duration, readDelay time.Duration, parallelRequests bool) *http.Client {
func RateLimitedHTTPClient(client *http.Client, writeDelay time.Duration, readDelay time.Duration, retryDelay time.Duration, parallelRequests bool, retryableErrors map[int]bool, maxRetries int) *http.Client {

client.Transport = NewEtagTransport(client.Transport)
client.Transport = NewRateLimitTransport(client.Transport, WithWriteDelay(writeDelay), WithReadDelay(readDelay), WithParallelRequests(parallelRequests))
client.Transport = logging.NewTransport("GitHub", client.Transport)
client.Transport = logging.NewSubsystemLoggingHTTPTransport("GitHub", client.Transport)
client.Transport = newPreviewHeaderInjectorTransport(map[string]string{
// TODO: remove when Stone Crop preview is moved to general availability in the GraphQL API
"Accept": "application/vnd.github.stone-crop-preview+json",
}, client.Transport)

if maxRetries > 0 {
client.Transport = NewRetryTransport(client.Transport, WithRetryDelay(retryDelay), WithRetryableErrors(retryableErrors), WithMaxRetries(maxRetries))
}

return client
}

Expand All @@ -54,7 +61,7 @@ func (c *Config) AuthenticatedHTTPClient() *http.Client {
)
client := oauth2.NewClient(ctx, ts)

return RateLimitedHTTPClient(client, c.WriteDelay, c.ReadDelay, c.ParallelRequests)
return RateLimitedHTTPClient(client, c.WriteDelay, c.ReadDelay, c.RetryDelay, c.ParallelRequests, c.RetryableErrors, c.MaxRetries)
}

func (c *Config) Anonymous() bool {
Expand All @@ -63,7 +70,7 @@ func (c *Config) Anonymous() bool {

func (c *Config) AnonymousHTTPClient() *http.Client {
client := &http.Client{Transport: &http.Transport{}}
return RateLimitedHTTPClient(client, c.WriteDelay, c.ReadDelay, c.ParallelRequests)
return RateLimitedHTTPClient(client, c.WriteDelay, c.ReadDelay, c.RetryDelay, c.ParallelRequests, c.RetryableErrors, c.MaxRetries)
}

func (c *Config) NewGraphQLClient(client *http.Client) (*githubv4.Client, error) {
Expand Down Expand Up @@ -130,7 +137,7 @@ func (c *Config) ConfigureOwner(owner *Owner) (*Owner, error) {
}

// Meta returns the meta parameter that is passed into subsequent resources
// https://godoc.org/github.com/hashicorp/terraform-plugin-sdk/helper/schema#ConfigureFunc
// https://godoc.org/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema#ConfigureFunc
func (c *Config) Meta() (interface{}, error) {

var client *http.Client
Expand All @@ -153,6 +160,7 @@ func (c *Config) Meta() (interface{}, error) {
var owner Owner
owner.v4client = v4client
owner.v3client = v3client
owner.StopContext = context.Background()

_, err = c.ConfigureOwner(&owner)
if err != nil {
Expand Down
25 changes: 25 additions & 0 deletions github/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,31 @@ func TestAccConfigMeta(t *testing.T) {

})

t.Run("returns a v3 REST API client with max retries", func(t *testing.T) {

config := Config{
Token: testToken,
BaseURL: "https://api.github.com/",
RetryableErrors: map[int]bool{
500: true,
502: true,
},
MaxRetries: 3,
}
meta, err := config.Meta()
if err != nil {
t.Fatalf("failed to return meta without error: %s", err.Error())
}

ctx := context.Background()
client := meta.(*Owner).v3client
_, _, err = client.Meta.Get(ctx)
if err != nil {
t.Fatalf("failed to validate returned client without error: %s", err.Error())
}

})

t.Run("returns a v4 GraphQL API client to manage individual resources", func(t *testing.T) {

config := Config{
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_actions_environment_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/google/go-github/v57/github"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceGithubActionsEnvironmentSecrets() *schema.Resource {
Expand Down
4 changes: 2 additions & 2 deletions github/data_source_github_actions_environment_secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccGithubActionsEnvironmentSecretsDataSource(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion github/data_source_github_actions_environment_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/google/go-github/v57/github"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceGithubActionsEnvironmentVariables() *schema.Resource {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccGithubActionsEnvironmentVariablesDataSource(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package github

import (
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplate() *schema.Resource {
Expand Down Expand Up @@ -38,7 +38,10 @@ func dataSourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateRea
}

d.SetId(orgName)
d.Set("include_claim_keys", template.IncludeClaimKeys)
err = d.Set("include_claim_keys", template.IncludeClaimKeys)
if err != nil {
return err
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateDataSource(t *testing.T) {
Expand Down
12 changes: 9 additions & 3 deletions github/data_source_github_actions_organization_public_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"context"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceGithubActionsOrganizationPublicKey() *schema.Resource {
Expand Down Expand Up @@ -40,8 +40,14 @@ func dataSourceGithubActionsOrganizationPublicKeyRead(d *schema.ResourceData, me
}

d.SetId(publicKey.GetKeyID())
d.Set("key_id", publicKey.GetKeyID())
d.Set("key", publicKey.GetKey())
err = d.Set("key_id", publicKey.GetKeyID())
if err != nil {
return err
}
err = d.Set("key", publicKey.GetKey())
if err != nil {
return err
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccGithubActionsOrganizationPublicKeyDataSource(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"log"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceGithubActionsOrganizationRegistrationToken() *schema.Resource {
Expand Down Expand Up @@ -36,8 +36,14 @@ func dataSourceGithubActionsOrganizationRegistrationTokenRead(d *schema.Resource
}

d.SetId(owner)
d.Set("token", token.Token)
d.Set("expires_at", token.ExpiresAt.Unix())
err = d.Set("token", token.Token)
if err != nil {
return err
}
err = d.Set("expires_at", token.ExpiresAt.Unix())
if err != nil {
return err
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccGithubActionsOrganizationRegistrationTokenDataSource(t *testing.T) {
Expand Down
7 changes: 5 additions & 2 deletions github/data_source_github_actions_organization_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/google/go-github/v57/github"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceGithubActionsOrganizationSecrets() *schema.Resource {
Expand Down Expand Up @@ -72,7 +72,10 @@ func dataSourceGithubActionsOrganizationSecretsRead(d *schema.ResourceData, meta
}

d.SetId(owner)
d.Set("secrets", all_secrets)
err := d.Set("secrets", all_secrets)
if err != nil {
return err
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccGithubActionsOrganizationSecretsDataSource(t *testing.T) {
Expand Down
7 changes: 5 additions & 2 deletions github/data_source_github_actions_organization_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/google/go-github/v57/github"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceGithubActionsOrganizationVariables() *schema.Resource {
Expand Down Expand Up @@ -76,7 +76,10 @@ func dataSourceGithubActionsOrganizationVariablesRead(d *schema.ResourceData, me
}

d.SetId(owner)
d.Set("variables", all_variables)
err := d.Set("variables", all_variables)
if err != nil {
return err
}

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strings"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccGithubActionsOrganizationVariablesDataSource(t *testing.T) {
Expand Down
12 changes: 9 additions & 3 deletions github/data_source_github_actions_public_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"context"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

func dataSourceGithubActionsPublicKey() *schema.Resource {
Expand Down Expand Up @@ -40,8 +40,14 @@ func dataSourceGithubActionsPublicKeyRead(d *schema.ResourceData, meta interface
}

d.SetId(publicKey.GetKeyID())
d.Set("key_id", publicKey.GetKeyID())
d.Set("key", publicKey.GetKey())
err = d.Set("key_id", publicKey.GetKeyID())
if err != nil {
return err
}
err = d.Set("key", publicKey.GetKey())
if err != nil {
return err
}

return nil
}
Loading
Loading