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 from upstream v5.18.0 #11

Merged
merged 66 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
ec17c62
Add support for enabling repo discussions
nbaechtold Dec 18, 2022
919cfe4
Merge branch 'main' into github-add-repo-discussions
nickfloyd Jan 3, 2023
e82d0a1
Use absolute link to CODE_OF_CONDUCT.md in issue templates (#1461)
F21 Jan 4, 2023
4cb0272
Merge branch 'main' into github-add-repo-discussions
nickfloyd Jan 4, 2023
0370eba
adds default value details to arg reference
nickfloyd Jan 4, 2023
9504738
feat: Add ability to enable GitHub Discussions on repositories
nickfloyd Jan 4, 2023
7f832ea
issue #1332: support workflow restrictions in github_actions_runner_g…
Nov 7, 2022
c86eb45
add test and fix unrelated typo
bob-bins Jan 5, 2023
8cdab64
build(deps): bump actions/stale from 6 to 7 (#1454)
dependabot[bot] Jan 5, 2023
e679a48
Remove usages of the lowercase h in GitHub (#1413)
kfcampbell Jan 5, 2023
c5928aa
Bump go-github to v49.0.0 (#1463)
AnitaErnszt Jan 5, 2023
be4dd36
build(deps): bump github.com/Masterminds/goutils from 1.1.0 to 1.1.1 …
dependabot[bot] Jan 5, 2023
ee6525b
fix: skip anonymous tests that can't be done anonymously (#1465)
wwsean08 Jan 6, 2023
8c7edb6
* update resourceGithubActionsRunnerGroup schema
bob-bins Jan 7, 2023
1f82d2a
build(deps): bump golang.org/x/crypto from 0.4.0 to 0.5.0
dependabot[bot] Jan 9, 2023
bec68d8
Updates for workflows
octokitbot Jan 9, 2023
5fd34dd
Merge pull request #1472 from integrations/workflow-update
nickfloyd Jan 9, 2023
0417b3b
Merge branch 'main' into dependabot/go_modules/golang.org/x/crypto-0.5.0
nickfloyd Jan 9, 2023
b0e28a4
Merge pull request #1468 from integrations/dependabot/go_modules/gola…
nickfloyd Jan 9, 2023
c9686b3
Add support for provisioning github orgs to enteprises.
swisniewski-marqeta Dec 22, 2022
d6af793
Merge branch 'main' into prepare_upstream
nickfloyd Jan 10, 2023
4ee09d4
Update v3 client reference to /v49 from /v48
swisniewski-marqeta Jan 11, 2023
6e2d470
feat: Add support for GitHub Actions OpenID Connect subject claim cus…
F21 Jan 10, 2023
f60e556
[feat] Add support for provisioning github orgs to enterprises.
nickfloyd Jan 11, 2023
1e348f6
Merge branch 'main' into oidc-subject-claim-customization-template
nickfloyd Jan 11, 2023
381f08c
fixes duplicates from the merge conflict
nickfloyd Jan 11, 2023
e5cda3a
Merge pull request #1473 from F21/oidc-subject-claim-customization-te…
nickfloyd Jan 11, 2023
f20fd94
Add links to OpenID Connect subject claim customization template reso…
F21 Jan 11, 2023
4644907
fix: verify & set parent team after creation (#1449)
reiniertimmer Jan 11, 2023
e6e09be
Update details of "members" property (#1115)
kroussou Jan 11, 2023
995019f
update restricted_to_workflows description
bob-bins Jan 12, 2023
216906c
minor formatting
bob-bins Jan 12, 2023
a180cea
Merge branch 'main' into 1332-workflow-restrictions
nickfloyd Jan 12, 2023
5ba2241
[feat] Adds restricted_to_workflows and selected_workflows fields
nickfloyd Jan 12, 2023
27458c8
Create codeql.yml
kfcampbell Jan 12, 2023
dba0745
Merge pull request #1483 from integrations/enable-codeql
nickfloyd Jan 13, 2023
89ef665
Initial commit of adding org owner team membership doc notes (#1467)
kfcampbell Jan 14, 2023
f81d021
fix: Actually populate the visibility within the resulting object. (#…
wwsean08 Jan 17, 2023
d27da35
Bugfix: fix github_branch_protection required_status_checks not remov…
jtgrohn Jan 17, 2023
c83839f
Bugfix: Make security_and_analysis settings optional (#1489)
jtgrohn Jan 18, 2023
8b93e4e
Set LDAP DN on team creation (#1491)
jMarkP Jan 18, 2023
592edcc
Fixing `github_repository_file` owner/org handling (#1494)
vmasutin Jan 18, 2023
c5cfce0
feature/985 branch protection `checks` (#1415)
TheQueenIsDead Jan 20, 2023
543774c
[FIX]: Issue-1498 (#1500)
pradeepbhadani Jan 21, 2023
8fdce4a
[docfix] Fix argument name in import section
pradeepbhadani Jan 21, 2023
f2aacaf
Merge pull request #1507 from pradeepbhadani/docfix-github-team-repos…
nickfloyd Jan 23, 2023
30cc485
Update to go-github v50 (#1516)
ilmax Jan 30, 2023
b524689
Update repository_webhook.html.markdown (#1512)
pavlospt Jan 31, 2023
fd54e80
Minor - Add missing doc for github_enterprise_organization and fix ty…
marknet15 Jan 31, 2023
75be5d4
Add Schema Attribute Descriptions For Repository Resources
X-Guardian Feb 1, 2023
ff50f85
Update required/optional for security_and_analysis fields in docs to …
danielpops Feb 3, 2023
fdb2e0c
feat(team_membership): allow id lookup from slug (#1502)
jhoenzsch Feb 3, 2023
9a39905
Adding new argument to the branch_default resource to allow renaming …
rhughes1 Feb 3, 2023
1a70927
feat: allow emtpy invitation IDs (#1488)
morremeyer Feb 4, 2023
2d1b724
allow github_actions_runner_group to be created with RestrictedToWork…
bob-bins Feb 4, 2023
dc16a74
Merge branch 'main' into attribute-descriptions-repository
X-Guardian Feb 8, 2023
61fe425
Merge pull request #1527 from X-Guardian/attribute-descriptions-repos…
nickfloyd Feb 10, 2023
7d0ca5f
build(deps): bump golang.org/x/crypto from 0.5.0 to 0.6.0 (#1543)
dependabot[bot] Feb 13, 2023
ab4070a
docs: fix erroneous github_repository_file docs (#1540)
GilUpstream Feb 13, 2023
9cf65a4
Dependency updates to fix broken builds (#1547)
kfcampbell Feb 13, 2023
8818e64
build(deps): bump github.com/hashicorp/go-getter from 1.6.2 to 1.7.0 …
dependabot[bot] Feb 17, 2023
dfe76b5
build(deps): bump golang.org/x/net from 0.6.0 to 0.7.0 (#1556)
dependabot[bot] Feb 17, 2023
bd36a1f
Support app auth and PAT via two provider instances (#1538)
MajorBreakfast Feb 17, 2023
92449fd
fix: support repository autolink references on non-default ports (#1552)
isometry Feb 17, 2023
8afbc19
Add Schema Attribute Descriptions For Remaining Resources (#1544)
X-Guardian Feb 17, 2023
68596e9
Merge branch 'main' into upstream-5.18.0
snovikov Feb 23, 2023
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
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ body:
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md)
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/integrations/terraform-provider-github/blob/main/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ body:
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md)
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/integrations/terraform-provider-github/blob/main/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/maintenance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ body:
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md)
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/integrations/terraform-provider-github/blob/main/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version: '1.20'
- run: make tools
- run: make lint
- run: make website-lint
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '16 7 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Autobuild
uses: github/codeql-action/autobuild@v2

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v6
- uses: actions/stale@v7
with:
stale-issue-message: >
👋 Hey Friends, this issue has been automatically marked as `stale` because it has no recent activity.
Expand Down
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ issues:
linters:
disable-all: true
enable:
- deadcode
- errcheck
- gofmt
- gosimple
- ineffassign
- misspell
- staticcheck
- structcheck
- unconvert
- unused
- varcheck
- vet

linters-settings:
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ BUG FIXES:

BUG FIXES:

* resource/github_branch_protection: Prevent enabling `dismissal_restrictions` in Github console if `dismissal_users` and `dismissal_teams` are not set ([#453](https://github.com/integrations/terraform-provider-github/issues/453))
* resource/github_branch_protection: Prevent enabling `dismissal_restrictions` in GitHub console if `dismissal_users` and `dismissal_teams` are not set ([#453](https://github.com/integrations/terraform-provider-github/issues/453))
* resource/github_repository_collaborator: Allow modifying permissions from `maintain` and `triage` ([#457](https://github.com/integrations/terraform-provider-github/issues/457))
* Documentation Fix for `github_actions_public_key` data-source ([#458](https://github.com/integrations/terraform-provider-github/issues/458))
* Documentation Fix for `github_branch_protection` resource ([#410](https://github.com/integrations/terraform-provider-github/issues/410))
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Once you have the repository cloned, there's a couple of additional steps you'll

- If you haven't already, [create a GitHub organization you can use for testing](#github-organization).
- Optional: some may find it beneficial to create a test user as well in order to avoid potential rate-limiting issues on your main account.
- Your organization _must_ have a repository called `terraform-module-template`. The [terraformtesting/terraform-template-module](https://github.com/terraformtesting/terraform-template-module) repo is a good, re-usable example.
- Your organization _must_ have a repository called `terraform-template-module`. The [terraformtesting/terraform-template-module](https://github.com/terraformtesting/terraform-template-module) repo is a good, re-usable example.
- You _must_ make sure that the "Template Repository" item in Settings is checked for this repo.
- If you haven't already, [generate a Personal Access Token (PAT) for authenticating your test runs](#github-personal-access-token).
- Export the necessary configuration for authenticating your provider with GitHub
Expand Down Expand Up @@ -218,9 +218,9 @@ Once the token has been created, it must be exported in your environment as `GIT

If you do not have an organization already that you are comfortable running tests against, you will need to [create one](https://help.github.com/en/articles/creating-a-new-organization-from-scratch). The free "Team for Open Source" org type is fine for these tests. The name of the organization must then be exported in your environment as `GITHUB_ORGANIZATION`.

Make sure that your organization has a `terraform-module-template` repository ([terraformtesting/terraform-template-module](https://github.com/terraformtesting/terraform-template-module) is an example you can clone) and that its "Template repository" item in Settings is checked.
Make sure that your organization has a `terraform-template-module` repository ([terraformtesting/terraform-template-module](https://github.com/terraformtesting/terraform-template-module) is an example you can clone) and that its "Template repository" item in Settings is checked.

If you are interested in using and/or testing Github's [Team synchronization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/synchronizing-teams-between-your-identity-provider-and-github) feature, please contact a maintainer as special arrangements can be made for your convenience.
If you are interested in using and/or testing GitHub's [Team synchronization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/synchronizing-teams-between-your-identity-provider-and-github) feature, please contact a maintainer as special arrangements can be made for your convenience.

## Resources

Expand Down
4 changes: 2 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ PKG_NAME=github
default: build

tools:
go install github.com/client9/misspell/cmd/misspell
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.48.0
go install github.com/client9/misspell/cmd/misspell@v0.3.4
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1

build: fmtcheck
go build ./...
Expand Down
18 changes: 18 additions & 0 deletions examples/repository_security_and_analysis/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Repository Visibility Example

This demos setting `security_and_analysis` for a repository. See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository for details on what these settings do.

This example will create a repositories in the specified `owner` organization. See https://www.terraform.io/docs/providers/github/index.html for details on configuring [`providers.tf`](./providers.tf) accordingly.

Alternatively, you may use variables passed via command line:

```console
export GITHUB_OWNER=
export GITHUB_TOKEN=
```

```console
terraform apply \
-var "owner=${GITHUB_OWNER}" \
-var "github_token=${GITHUB_TOKEN}"
```
19 changes: 19 additions & 0 deletions examples/repository_security_and_analysis/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "github_repository" "terraformed" {
name = "terraformed"
description = "A repository created by terraform"
visibility = "public"

security_and_analysis {
# Cannot set advanced_security for public repositories as it is always on by default.
# advanced_security {
# status = "enabled"
# }
secret_scanning {
status = "enabled"
}
secret_scanning_push_protection {
status = "enabled"
}
}
}

4 changes: 4 additions & 0 deletions examples/repository_security_and_analysis/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "repository" {
description = "Example repository JSON blob"
value = github_repository.terraformed
}
12 changes: 12 additions & 0 deletions examples/repository_security_and_analysis/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
provider "github" {
owner = var.owner
token = var.github_token
}

terraform {
required_providers {
github = {
source = "integrations/github"
}
}
}
9 changes: 9 additions & 0 deletions examples/repository_security_and_analysis/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "owner" {
description = "GitHub owner used to configure the provider"
type = string
}

variable "github_token" {
description = "GitHub access token used to configure the provider"
type = string
}
4 changes: 2 additions & 2 deletions github/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"strings"
"time"

"github.com/google/go-github/v48/github"
"github.com/google/go-github/v50/github"
"github.com/hashicorp/terraform-plugin-sdk/helper/logging"
"github.com/shurcooL/githubv4"
"golang.org/x/oauth2"
Expand Down Expand Up @@ -37,7 +37,7 @@ func RateLimitedHTTPClient(client *http.Client, writeDelay time.Duration, readDe

client.Transport = NewEtagTransport(client.Transport)
client.Transport = NewRateLimitTransport(client.Transport, WithWriteDelay(writeDelay), WithReadDelay(readDelay))
client.Transport = logging.NewTransport("Github", client.Transport)
client.Transport = logging.NewTransport("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",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package github

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

func dataSourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplate() *schema.Resource {
return &schema.Resource{
Read: dataSourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateRead,

Schema: map[string]*schema.Schema{
"include_claim_keys": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
},
}
}

func dataSourceGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateRead(d *schema.ResourceData, meta interface{}) error {

client := meta.(*Owner).v3client
orgName := meta.(*Owner).name
ctx := meta.(*Owner).StopContext

err := checkOrganization(meta)
if err != nil {
return err
}

template, _, err := client.Actions.GetOrgOIDCSubjectClaimCustomTemplate(ctx, orgName)

if err != nil {
return err
}

d.SetId(orgName)
d.Set("include_claim_keys", template.IncludeClaimKeys)

return nil
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package github

import (
"testing"

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

func TestAccGithubActionsOrganizationOIDCSubjectClaimCustomizationTemplateDataSource(t *testing.T) {

t.Run("get an organization oidc subject claim customization template without error", func(t *testing.T) {

config := `
resource "github_actions_organization_oidc_subject_claim_customization_template" "test" {
include_claim_keys = ["actor", "actor_id", "head_ref", "repository"]
}
`

config2 := config + `
data "github_actions_organization_oidc_subject_claim_customization_template" "test" {}
`

check := resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.github_actions_organization_oidc_subject_claim_customization_template.test", "include_claim_keys.#", "4"),
resource.TestCheckResourceAttr("data.github_actions_organization_oidc_subject_claim_customization_template.test", "include_claim_keys.0", "actor"),
resource.TestCheckResourceAttr("data.github_actions_organization_oidc_subject_claim_customization_template.test", "include_claim_keys.1", "actor_id"),
resource.TestCheckResourceAttr("data.github_actions_organization_oidc_subject_claim_customization_template.test", "include_claim_keys.2", "head_ref"),
resource.TestCheckResourceAttr("data.github_actions_organization_oidc_subject_claim_customization_template.test", "include_claim_keys.3", "repository"),
)

testCase := func(t *testing.T, mode string) {
resource.Test(t, resource.TestCase{
PreCheck: func() { skipUnlessMode(t, mode) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(),
},
{
Config: config2,
Check: check,
},
},
})
}

t.Run("with an anonymous account", func(t *testing.T) {
t.Skip("anonymous account not supported for this operation")
})

t.Run("with an individual account", func(t *testing.T) {
t.Skip("individual account not supported for this operation")
})

t.Run("with an organization account", func(t *testing.T) {
testCase(t, organization)
})
})
}
3 changes: 2 additions & 1 deletion github/data_source_github_actions_organization_secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package github
import (
"context"

"github.com/google/go-github/v48/github"
"github.com/google/go-github/v50/github"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
Expand Down Expand Up @@ -60,6 +60,7 @@ func dataSourceGithubActionsOrganizationSecretsRead(d *schema.ResourceData, meta
"name": secret.Name,
"created_at": secret.CreatedAt.String(),
"updated_at": secret.UpdatedAt.String(),
"visibility": secret.Visibility,
}
all_secrets = append(all_secrets, new_secret)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestAccGithubActionsOrganizationSecretsDataSource(t *testing.T) {
resource "github_actions_organization_secret" "test" {
secret_name = "org_secret_1_%s"
plaintext_value = "foo"
visibility = "private"
visibility = "all" # going with all as it does not require a paid subscrption
}
`, randomID)

Expand All @@ -30,7 +30,7 @@ func TestAccGithubActionsOrganizationSecretsDataSource(t *testing.T) {
check := resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.github_actions_organization_secrets.test", "secrets.#", "1"),
resource.TestCheckResourceAttr("data.github_actions_organization_secrets.test", "secrets.0.name", strings.ToUpper(fmt.Sprintf("ORG_SECRET_1_%s", randomID))),
resource.TestCheckResourceAttr("data.github_actions_organization_secrets.test", "secrets.0.visibility", "private"),
resource.TestCheckResourceAttr("data.github_actions_organization_secrets.test", "secrets.0.visibility", "all"),
resource.TestCheckResourceAttrSet("data.github_actions_organization_secrets.test", "secrets.0.created_at"),
resource.TestCheckResourceAttrSet("data.github_actions_organization_secrets.test", "secrets.0.updated_at"),
)
Expand Down
Loading