diff --git a/docs/README.md b/docs/README.md deleted file mode 100644 index 4e768b5..0000000 --- a/docs/README.md +++ /dev/null @@ -1 +0,0 @@ -# \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..826a3c0 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,44 @@ +# Github Provider + +The CloudQuery Github provider extracts and transforms your AWS cloud assets configuration into PostgreSQL. + +## Install + +```shell +cloudquery init github +``` + +## Authentication + +CloudQuery requires only a Personal Access Token, follow this [guide](https://docs.github.com/en/enterprise-server@3.4/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) by github +on how to create a personal access token for CloudQuery. + +## Configuration + +CloudQuery needs to be authenticated with your Github account's Personal Token in order to fetch information about your Github organizations. +CloudQuery requires only *read* permissions (we will never make any changes to your github account or organizations), +so, following the principle of least privilege, it's recommended to grant it read-only permissions. + +Add the following Block your your providers list in your `cloudquery.yml` configuration. +```yaml + - name: github + configuration: + access_token: " + orgs: [""] + resources: + - organizations + - repositories + - teams + - billing.actions + - billing.packages + - billing.storage + - issues + - hooks + - installations + - external_groups + + + +``` + +More information can be found in the [CloudQuery documentation](https://docs.cloudquery.io/docs/developers/debugging) \ No newline at end of file diff --git a/resources/issues.go b/resources/issues.go index 7ac841e..ab6c97f 100644 --- a/resources/issues.go +++ b/resources/issues.go @@ -1555,6 +1555,8 @@ func Issues() *schema.Table { func fetchIssues(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { c := meta.(*client.Client) opts := &github.IssueListOptions{ + Filter: "all", + State: "all", ListOptions: github.ListOptions{ Page: 0, PerPage: 100, diff --git a/resources/organizations.go b/resources/organizations.go index 51cc746..1d547cb 100644 --- a/resources/organizations.go +++ b/resources/organizations.go @@ -589,8 +589,10 @@ func resolveOrganizationMembersTextMatches(ctx context.Context, meta schema.Clie func fetchOrganizationMemberMemberships(ctx context.Context, meta schema.ClientMeta, parent *schema.Resource, res chan<- interface{}) error { c := meta.(*client.Client) m := parent.Item.(*github.User) - - membership, _, err := c.Github.Organizations.GetOrgMembership(ctx, *m.Name, c.Org) + if m == nil { + return nil + } + membership, _, err := c.Github.Organizations.GetOrgMembership(ctx, *m.Login, c.Org) if err != nil { return diag.WrapError(err) } diff --git a/resources/organizations_test.go b/resources/organizations_test.go index 6ed586f..e0c85a7 100644 --- a/resources/organizations_test.go +++ b/resources/organizations_test.go @@ -30,7 +30,7 @@ func buildOrganizations(t *testing.T, ctrl *gomock.Controller) client.GithubServ if err := faker.FakeDataSkipFields(&m, []string{}); err != nil { t.Fatal(err) } - mock.EXPECT().GetOrgMembership(gomock.Any(), *u.Name, gomock.Any()).Return( + mock.EXPECT().GetOrgMembership(gomock.Any(), *u.Login, gomock.Any()).Return( &m, &github.Response{}, nil) return client.GithubServices{Organizations: mock}