diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b672273..9bb1283 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook - rev: v9.5.0 + rev: v9.13.0 hooks: - id: commitlint stages: [commit-msg] diff --git a/docs/data-sources/repository_secret.md b/docs/data-sources/repository_secret.md index aeed754..dce822d 100644 --- a/docs/data-sources/repository_secret.md +++ b/docs/data-sources/repository_secret.md @@ -33,6 +33,6 @@ data "woodpecker_repository_secret" "test_secret" { ### Read-Only -- `events` (Set of String) events for which the secret is available (push, tag, pull_request, deployment, cron, manual) +- `events` (Set of String) events for which the secret is available (push, tag, pull_request, pull_request_closed, deployment, cron, manual, release) - `id` (Number) the secret's id - `images` (Set of String) list of Docker images for which this secret is available diff --git a/docs/data-sources/secret.md b/docs/data-sources/secret.md index e8734b6..6fbc046 100644 --- a/docs/data-sources/secret.md +++ b/docs/data-sources/secret.md @@ -27,6 +27,6 @@ data "woodpecker_secret" "test_secret" { ### Read-Only -- `events` (Set of String) events for which the secret is available (push, tag, pull_request, deployment, cron, manual) +- `events` (Set of String) events for which the secret is available (push, tag, pull_request, pull_request_closed, deployment, cron, manual, release) - `id` (Number) the secret's id - `images` (Set of String) list of Docker images for which this secret is available diff --git a/docs/resources/repository_secret.md b/docs/resources/repository_secret.md index 031e79e..c982260 100644 --- a/docs/resources/repository_secret.md +++ b/docs/resources/repository_secret.md @@ -32,7 +32,7 @@ resource "woodpecker_repository_secret" "test" { ### Required -- `events` (Set of String) events for which the secret is available (push, tag, pull_request, deployment, cron, manual) +- `events` (Set of String) events for which the secret is available (push, tag, pull_request, pull_request_closed, deployment, cron, manual, release) - `name` (String) the name of the secret - `repository_id` (Number) the ID of the repository - `value` (String, Sensitive) the value of the secret diff --git a/docs/resources/secret.md b/docs/resources/secret.md index 290d7b3..994ea62 100644 --- a/docs/resources/secret.md +++ b/docs/resources/secret.md @@ -26,7 +26,7 @@ resource "woodpecker_secret" "test" { ### Required -- `events` (Set of String) events for which the secret is available (push, tag, pull_request, deployment, cron, manual) +- `events` (Set of String) events for which the secret is available (push, tag, pull_request, pull_request_closed, deployment, cron, manual, release) - `name` (String) the name of the secret - `value` (String, Sensitive) the value of the secret diff --git a/internal/data_source_repository_secret.go b/internal/data_source_repository_secret.go index ebdefe6..a359b00 100644 --- a/internal/data_source_repository_secret.go +++ b/internal/data_source_repository_secret.go @@ -52,7 +52,8 @@ func (d *repositorySecretDataSource) Schema( "events": schema.SetAttribute{ ElementType: types.StringType, Computed: true, - Description: "events for which the secret is available (push, tag, pull_request, deployment, cron, manual)", + Description: "events for which the secret is available " + + "(push, tag, pull_request, pull_request_closed, deployment, cron, manual, release)", }, "images": schema.SetAttribute{ ElementType: types.StringType, diff --git a/internal/data_source_secret.go b/internal/data_source_secret.go index c841766..5b340b5 100644 --- a/internal/data_source_secret.go +++ b/internal/data_source_secret.go @@ -44,7 +44,8 @@ func (d *secretDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, "events": schema.SetAttribute{ ElementType: types.StringType, Computed: true, - Description: "events for which the secret is available (push, tag, pull_request, deployment, cron, manual)", + Description: "events for which the secret is available " + + "(push, tag, pull_request, pull_request_closed, deployment, cron, manual, release)", }, "images": schema.SetAttribute{ ElementType: types.StringType, diff --git a/internal/resource_repository_secret.go b/internal/resource_repository_secret.go index 14cf8bb..0db2f7d 100644 --- a/internal/resource_repository_secret.go +++ b/internal/resource_repository_secret.go @@ -82,10 +82,20 @@ func (r *repositorySecretResource) Schema(_ context.Context, _ resource.SchemaRe "events": schema.SetAttribute{ ElementType: types.StringType, Required: true, - Description: "events for which the secret is available (push, tag, pull_request, deployment, cron, manual)", + Description: "events for which the secret is available " + + "(push, tag, pull_request, pull_request_closed, deployment, cron, manual, release)", Validators: []validator.Set{ setvalidator.ValueStringsAre( - stringvalidator.OneOfCaseInsensitive("push", "tag", "pull_request", "deployment", "cron", "manual"), + stringvalidator.OneOfCaseInsensitive( + "push", + "tag", + "pull_request", + "pull_request_closed", + "deployment", + "cron", + "manual", + "release", + ), ), }, PlanModifiers: []planmodifier.Set{ @@ -300,10 +310,20 @@ func (r *repositorySecretResource) UpgradeState(_ context.Context) map[int64]res "events": schema.SetAttribute{ ElementType: types.StringType, Required: true, - Description: "events for which the secret is available (push, tag, pull_request, deployment, cron, manual)", + Description: "events for which the secret is available " + + "(push, tag, pull_request, pull_request_closed, deployment, cron, manual, release)", Validators: []validator.Set{ setvalidator.ValueStringsAre( - stringvalidator.OneOfCaseInsensitive("push", "tag", "pull_request", "deployment", "cron", "manual"), + stringvalidator.OneOfCaseInsensitive( + "push", + "tag", + "pull_request", + "pull_request_closed", + "deployment", + "cron", + "manual", + "release", + ), ), }, PlanModifiers: []planmodifier.Set{ diff --git a/internal/resource_repository_secret_test.go b/internal/resource_repository_secret_test.go index be73cd7..b8305f6 100644 --- a/internal/resource_repository_secret_test.go +++ b/internal/resource_repository_secret_test.go @@ -62,7 +62,7 @@ resource "woodpecker_repository_secret" "test_secret" { repository_id = %d name = "%s" value = "test123123" - events = ["push", "deployment"] + events = ["push", "deployment", "release", "pull_request_closed"] images = ["testimage"] } `, repo.ID, name), @@ -77,6 +77,8 @@ resource "woodpecker_repository_secret" "test_secret" { resource.TestCheckResourceAttr("woodpecker_repository_secret.test_secret", "value", "test123123"), resource.TestCheckTypeSetElemAttr("woodpecker_repository_secret.test_secret", "events.*", "push"), resource.TestCheckTypeSetElemAttr("woodpecker_repository_secret.test_secret", "events.*", "deployment"), + resource.TestCheckTypeSetElemAttr("woodpecker_repository_secret.test_secret", "events.*", "release"), + resource.TestCheckTypeSetElemAttr("woodpecker_repository_secret.test_secret", "events.*", "pull_request_closed"), resource.TestCheckTypeSetElemAttr("woodpecker_repository_secret.test_secret", "images.*", "testimage"), ), }, diff --git a/internal/resource_secret.go b/internal/resource_secret.go index 351b8e9..da9d2b6 100644 --- a/internal/resource_secret.go +++ b/internal/resource_secret.go @@ -68,10 +68,20 @@ func (r *secretResource) Schema(_ context.Context, _ resource.SchemaRequest, res "events": schema.SetAttribute{ ElementType: types.StringType, Required: true, - Description: "events for which the secret is available (push, tag, pull_request, deployment, cron, manual)", + Description: "events for which the secret is available " + + "(push, tag, pull_request, pull_request_closed, deployment, cron, manual, release)", Validators: []validator.Set{ setvalidator.ValueStringsAre( - stringvalidator.OneOfCaseInsensitive("push", "tag", "pull_request", "deployment", "cron", "manual"), + stringvalidator.OneOfCaseInsensitive( + "push", + "tag", + "pull_request", + "pull_request_closed", + "deployment", + "cron", + "manual", + "release", + ), ), }, PlanModifiers: []planmodifier.Set{ @@ -246,10 +256,20 @@ func (r *secretResource) UpgradeState(_ context.Context) map[int64]resource.Stat "events": schema.SetAttribute{ ElementType: types.StringType, Required: true, - Description: "events for which the secret is available (push, tag, pull_request, deployment, cron, manual)", + Description: "events for which the secret is available " + + "(push, tag, pull_request, pull_request_closed, deployment, cron, manual, release)", Validators: []validator.Set{ setvalidator.ValueStringsAre( - stringvalidator.OneOfCaseInsensitive("push", "tag", "pull_request", "deployment", "cron", "manual"), + stringvalidator.OneOfCaseInsensitive( + "push", + "tag", + "pull_request", + "pull_request_closed", + "deployment", + "cron", + "manual", + "release", + ), ), }, PlanModifiers: []planmodifier.Set{