Skip to content

Commit

Permalink
Merge pull request #358 from Interhyp/RELTEC-12275
Browse files Browse the repository at this point in the history
RELTEC-12275: add new config property actionsAccess
  • Loading branch information
KRaffael authored Nov 13, 2024
2 parents f1b00ee + 98c7ed5 commit b7610e1
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/generated_model_repository_configuration_dto.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions api/generated_model_repository_configuration_patch_dto.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions api/openapi-v3-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2089,6 +2089,14 @@ components:
refMatcher: main
additionalProperties:
$ref: '#/components/schemas/ConditionReferenceDto'
actionsAccess:
description: Control how the repository is used by GitHub Actions workflows in other repositories
type: string
enum:
- NONE
- ORGANIZATION
- ENTERPRISE
example: NOT_ACCESSIBLE
RepositoryConfigurationPatchDto:
description: Attributes to configure the repository. If a configuration exists there are also some configured defaults for the repository.
type: object
Expand Down Expand Up @@ -2159,6 +2167,14 @@ components:
unmanaged:
description: 'Repository will not be configured, also not archived.'
type: boolean
actionsAccess:
description: Control how the repository is used by GitHub Actions workflows in other repositories
type: string
enum:
- NONE
- ORGANIZATION
- ENTERPRISE
example: NOT_ACCESSIBLE
MergeStrategy:
type: object
properties:
Expand Down
1 change: 1 addition & 0 deletions internal/service/repositories/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ func patchConfiguration(patch *openapi.RepositoryConfigurationPatchDto, original
Approvers: patchApprovers(patch.Approvers, original.Approvers),
Watchers: patchStringSlice(patch.Watchers, original.Watchers),
Archived: patchPtr[bool](patch.Archived, original.Archived),
ActionsAccess: patchStringPtr(patch.ActionsAccess, original.ActionsAccess),
// fields not allowed for patching carry over from original
RequireIssue: original.RequireIssue,
RequireConditions: original.RequireConditions,
Expand Down
5 changes: 5 additions & 0 deletions internal/service/repositories/repositories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func createRepositoryConfigurationPatchDtoFromConfigurationDto(input *openapi.Re
return &openapi.RepositoryConfigurationPatchDto{
AccessKeys: input.AccessKeys,
CommitMessageType: input.CommitMessageType,
ActionsAccess: input.ActionsAccess,
RequireSuccessfulBuilds: input.RequireSuccessfulBuilds,
Webhooks: input.Webhooks,
Approvers: input.Approvers,
Expand Down Expand Up @@ -139,6 +140,7 @@ func TestPatchRepository_ReplaceAll(t *testing.T) {
BranchNameRegex: ptr("(testing_[^_-]+_[^-]+$)"),
CommitMessageRegex: ptr("(([A-Z][A-Z_0-9]+-[0-9]+))(.|\\n)*"),
CommitMessageType: ptr("DEFAULT"),
ActionsAccess: ptr("ENTERPRISE"),
RequireSuccessfulBuilds: i(2),
Webhooks: &openapi.RepositoryConfigurationWebhooksDto{
Additional: []openapi.RepositoryConfigurationWebhookDto{
Expand Down Expand Up @@ -173,6 +175,7 @@ func TestPatchRepository_ReplaceAll(t *testing.T) {
BranchNameRegex: ptr("(testing_[^_-]+_[^-]+$)"),
CommitMessageRegex: ptr("(([A-Z][A-Z_0-9]+-[0-9]+))(.|\\n)*"),
CommitMessageType: ptr("DEFAULT"),
ActionsAccess: ptr("ENTERPRISE"),
RequireIssue: ptr(false),
RequireSuccessfulBuilds: i(2),
Webhooks: &openapi.RepositoryConfigurationWebhooksDto{
Expand Down Expand Up @@ -205,6 +208,7 @@ func TestPatchRepository_ClearFields(t *testing.T) {
Configuration: &openapi.RepositoryConfigurationPatchDto{
AccessKeys: []openapi.RepositoryConfigurationAccessKeyDto{},
CommitMessageType: ptr(""),
ActionsAccess: ptr(""),
Webhooks: &openapi.RepositoryConfigurationWebhooksDto{
Additional: []openapi.RepositoryConfigurationWebhookDto{},
},
Expand All @@ -223,6 +227,7 @@ func TestPatchRepository_ClearFields(t *testing.T) {
Configuration: &openapi.RepositoryConfigurationDto{
AccessKeys: nil,
CommitMessageType: nil,
ActionsAccess: nil,
RequireIssue: ptr(false),
RequireSuccessfulBuilds: i(1),
Webhooks: &openapi.RepositoryConfigurationWebhooksDto{
Expand Down

0 comments on commit b7610e1

Please sign in to comment.