Skip to content

Commit e722b7e

Browse files
committed
Merge branch 'main' into main
2 parents 3d3ec9f + ecd4b0d commit e722b7e

4 files changed

Lines changed: 43 additions & 19 deletions

File tree

.github/workflows/codeql.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
cache: true
5050

5151
- name: Initialize CodeQL
52-
uses: github/codeql-action/init@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
52+
uses: github/codeql-action/init@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3
5353
with:
5454
languages: ${{ matrix.language }}
5555
build-mode: ${{ matrix.build-mode }}
@@ -60,6 +60,6 @@ jobs:
6060
run: go build ./...
6161

6262
- name: Perform CodeQL Analysis
63-
uses: github/codeql-action/analyze@45cbd0c69e560cd9e7cd7f8c32362050c9b7ded2 # v4.32.2
63+
uses: github/codeql-action/analyze@9e907b5e64f6b83e7804b09294d44122997950d6 # v4.32.3
6464
with:
6565
category: "/language:${{matrix.language}}"
Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,51 @@
11
package github
22

33
import (
4+
"context"
45
"testing"
56

67
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
78
)
89

9-
// TestAccGithubOrganizationAppInstallations requires at least one GitHub App
10-
// to be installed in the test organization (GITHUB_OWNER). If no apps are
11-
// installed, the attribute checks below will fail.
1210
func TestAccGithubOrganizationAppInstallations(t *testing.T) {
13-
config := `data "github_organization_app_installations" "test" {}`
14-
15-
resource.Test(t, resource.TestCase{
16-
PreCheck: func() { skipUnlessHasOrgs(t) },
17-
ProviderFactories: providerFactories,
18-
Steps: []resource.TestStep{
19-
{
20-
Config: config,
21-
Check: resource.ComposeAggregateTestCheckFunc(
22-
resource.TestCheckResourceAttrSet("data.github_organization_app_installations.test", "installations.0.id"),
23-
resource.TestCheckResourceAttrSet("data.github_organization_app_installations.test", "installations.0.app_slug"),
24-
resource.TestCheckResourceAttrSet("data.github_organization_app_installations.test", "installations.0.app_id"),
25-
),
11+
12+
t.Run("basic", func(t *testing.T) {
13+
config := `data "github_organization_app_installations" "test" {}`
14+
15+
resource.Test(t, resource.TestCase{
16+
PreCheck: func() {
17+
skipUnlessHasOrgs(t)
18+
skipUnlessHasAppInstallations(t)
2619
},
27-
},
20+
ProviderFactories: providerFactories,
21+
Steps: []resource.TestStep{
22+
{
23+
Config: config,
24+
Check: resource.ComposeAggregateTestCheckFunc(
25+
resource.TestCheckResourceAttrSet("data.github_organization_app_installations.test", "installations.0.id"),
26+
resource.TestCheckResourceAttrSet("data.github_organization_app_installations.test", "installations.0.app_slug"),
27+
resource.TestCheckResourceAttrSet("data.github_organization_app_installations.test", "installations.0.app_id"),
28+
),
29+
},
30+
},
31+
})
2832
})
2933
}
34+
35+
func skipUnlessHasAppInstallations(t *testing.T) {
36+
t.Helper()
37+
38+
meta, err := getTestMeta()
39+
if err != nil {
40+
t.Fatalf("failed to get test meta: %s", err)
41+
}
42+
43+
installations, _, err := meta.v3client.Organizations.ListInstallations(context.Background(), meta.name, nil)
44+
if err != nil {
45+
t.Fatalf("failed to list app installations: %s", err)
46+
}
47+
48+
if len(installations.Installations) == 0 {
49+
t.Skip("Skipping because no GitHub App installations found in the test organization")
50+
}
51+
}

website/docs/r/actions_organization_permissions.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ The following arguments are supported:
3939
* `enabled_repositories` - (Required) The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: `all`, `none`, or `selected`.
4040
* `allowed_actions_config` - (Optional) Sets the actions that are allowed in an organization. Only available when `allowed_actions` = `selected`. See [Allowed Actions Config](#allowed-actions-config) below for details.
4141
* `enabled_repositories_config` - (Optional) Sets the list of selected repositories that are enabled for GitHub Actions in an organization. Only available when `enabled_repositories` = `selected`. See [Enabled Repositories Config](#enabled-repositories-config) below for details.
42+
* `sha_pinning_required` - (Optional) Whether pinning to a specific SHA is required for all actions and reusable workflows in the organization.
4243

4344
### Allowed Actions Config
4445

website/docs/r/actions_repository_permissions.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ The following arguments are supported:
3636
* `allowed_actions` - (Optional) The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`.
3737
* `enabled` - (Optional) Should GitHub actions be enabled on this repository?
3838
* `allowed_actions_config` - (Optional) Sets the actions that are allowed in an repository. Only available when `allowed_actions` = `selected`. See [Allowed Actions Config](#allowed-actions-config) below for details.
39+
* `sha_pinning_required` - (Optional) Whether pinning to a specific SHA is required for all actions and reusable workflows in the repository.
3940

4041
### Allowed Actions Config
4142

0 commit comments

Comments
 (0)