Skip to content

Commit

Permalink
Merge pull request #505 from spacelift-io/multivcs-add-missing-webhoo…
Browse files Browse the repository at this point in the history
…k-url-for-github

Multi VCS - add missing webhook_url for GitHub (#477)
  • Loading branch information
truszkowski authored Feb 2, 2024
2 parents 00daf9a + 591b072 commit 46c4efe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/data-sources/github_enterprise_integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ data "spacelift_github_enterprise_integration" "github_enterprise_integration" {
- `name` (String) Github integration name
- `space_id` (String) Github integration space id
- `webhook_secret` (String) Github integration webhook secret
- `webhook_url` (String) Github integration webhook url
8 changes: 8 additions & 0 deletions spacelift/data_github_enterprise_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const (
ghEnterpriseAppID = "app_id"
ghEnterpriseAPIHost = "api_host"
ghEnterpriseWebhookSecret = "webhook_secret"
ghEnterpriseWebhookURL = "webhook_url"

defaultGHEIntegrationID = "github-enterprise-default-integration"
)
Expand Down Expand Up @@ -73,6 +74,11 @@ func dataGithubEnterpriseIntegration() *schema.Resource {
Description: "Github integration webhook secret",
Computed: true,
},
ghEnterpriseWebhookURL: {
Type: schema.TypeString,
Description: "Github integration webhook url",
Computed: true,
},
ghEnterpriseAppID: {
Type: schema.TypeString,
Description: "Github integration app id",
Expand All @@ -88,6 +94,7 @@ func dataGithubEnterpriseIntegrationRead(ctx context.Context, d *schema.Resource
AppID string `graphql:"appID"`
APIHost string `graphql:"apiHost"`
WebhookSecret string `graphql:"webhookSecret"`
WebhookURL string `graphql:"webhookUrl"`
ID string `graphql:"id"`
Name string `graphql:"name"`
Description string `graphql:"description"`
Expand Down Expand Up @@ -117,6 +124,7 @@ func dataGithubEnterpriseIntegrationRead(ctx context.Context, d *schema.Resource
d.SetId(githubEnterpriseIntegration.ID)
d.Set(ghEnterpriseAPIHost, githubEnterpriseIntegration.APIHost)
d.Set(ghEnterpriseWebhookSecret, githubEnterpriseIntegration.WebhookSecret)
d.Set(ghEnterpriseWebhookURL, githubEnterpriseIntegration.WebhookURL)
d.Set(ghEnterpriseAppID, githubEnterpriseIntegration.AppID)
d.Set(ghEnterpriseId, githubEnterpriseIntegration.ID)
d.Set(ghEnterpriseName, githubEnterpriseIntegration.Name)
Expand Down
2 changes: 2 additions & 0 deletions spacelift/data_github_enterprise_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestGithubEnterpriseIntegrationData(t *testing.T) {
Attribute("space_id", IsNotEmpty()),
Attribute("api_host", Equals(os.Getenv("SPACELIFT_PROVIDER_TEST_GITHUB_ENTERPRISE_API_HOST"))),
Attribute("webhook_secret", Equals(os.Getenv("SPACELIFT_PROVIDER_TEST_GITHUB_ENTERPRISE_WEBHOOK_SECRET"))),
Attribute("webhook_url", IsNotEmpty()),
Attribute("app_id", Equals(os.Getenv("SPACELIFT_PROVIDER_TEST_GITHUB_ENTERPRISE_APP_ID"))),
),
}})
Expand All @@ -43,6 +44,7 @@ func TestGithubEnterpriseIntegrationData(t *testing.T) {
Attribute("space_id", IsNotEmpty()),
Attribute("api_host", Equals(os.Getenv("SPACELIFT_PROVIDER_TEST_GITHUB_ENTERPRISE_API_HOST"))),
Attribute("webhook_secret", Equals(os.Getenv("SPACELIFT_PROVIDER_TEST_GITHUB_ENTERPRISE_WEBHOOK_SECRET"))),
Attribute("webhook_url", IsNotEmpty()),
Attribute("app_id", Equals(os.Getenv("SPACELIFT_PROVIDER_TEST_GITHUB_ENTERPRISE_APP_ID"))),
),
}})
Expand Down

0 comments on commit 46c4efe

Please sign in to comment.