From a91c38b9d3137768858871f517b1a9c9eef22363 Mon Sep 17 00:00:00 2001 From: Seth Vargo Date: Wed, 9 May 2018 16:22:07 +0100 Subject: [PATCH] Add html_url to github_repository --- github/resource_github_repository.go | 5 +++++ github/resource_github_repository_test.go | 3 +++ website/docs/r/repository.html.markdown | 2 ++ 3 files changed, 10 insertions(+) diff --git a/github/resource_github_repository.go b/github/resource_github_repository.go index 9383a8678d..f5e20c4cf7 100644 --- a/github/resource_github_repository.go +++ b/github/resource_github_repository.go @@ -93,6 +93,10 @@ func resourceGithubRepository() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "html_url": { + Type: schema.TypeString, + Computed: true, + }, "ssh_clone_url": { Type: schema.TypeString, Computed: true, @@ -198,6 +202,7 @@ func resourceGithubRepositoryRead(d *schema.ResourceData, meta interface{}) erro d.Set("has_downloads", repo.HasDownloads) d.Set("full_name", repo.FullName) d.Set("default_branch", repo.DefaultBranch) + d.Set("html_url", repo.HTMLURL) d.Set("ssh_clone_url", repo.SSHURL) d.Set("svn_url", repo.SVNURL) d.Set("git_clone_url", repo.GitURL) diff --git a/github/resource_github_repository_test.go b/github/resource_github_repository_test.go index 0774bce60a..40ea1a90ec 100644 --- a/github/resource_github_repository_test.go +++ b/github/resource_github_repository_test.go @@ -408,6 +408,9 @@ func testAccCheckGithubRepositoryAttributes(repo *github.Repository, want *testA if !strings.HasPrefix(*repo.CloneURL, "https://") { return fmt.Errorf("got Clone URL %q; want to start with 'https://'", *repo.CloneURL) } + if !strings.HasSuffix(*repo.HTMLURL, "/"+want.Name) { + return fmt.Errorf("got HTML URL %q; want to end with '%s'", *repo.HTMLURL, want.Name) + } if !strings.HasSuffix(*repo.SSHURL, "/"+want.Name+".git") { return fmt.Errorf("got SSH URL %q; want to end with '/%s.git'", *repo.SSHURL, want.Name) } diff --git a/website/docs/r/repository.html.markdown b/website/docs/r/repository.html.markdown index 6494ae0555..98100e591c 100644 --- a/website/docs/r/repository.html.markdown +++ b/website/docs/r/repository.html.markdown @@ -74,6 +74,8 @@ The following additional attributes are exported: * `full_name` - A string of the form "orgname/reponame". +* `html_url` - URL to the repository on the web. + * `ssh_clone_url` - URL that can be provided to `git clone` to clone the repository via SSH.