-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GitHub tree #133
GitHub tree #133
Conversation
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Hey @asfaltboy , thanks for opening this PR and sorry we've missed it for so long! I'm going to re-open it and we'll review it early next week. If we have any feedback or suggestions, we'll add them back in the PR. |
return &plugin.Table{ | ||
Name: "github_tree", | ||
Description: "Tree in the given repository, lists files in the git tree", | ||
Get: &plugin.GetConfig{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please replace get with the list as below -
List: &plugin.ListConfig{
Hydrate: tableGitHubTreeGet,
ShouldIgnoreError: isNotFoundError([]string{"404"}),
KeyColumns: []*plugin.KeyColumn{
{Name: "repository_full_name", Require: plugin.Required},
{Name: "sha", Require: plugin.Required},
{Name: "recursive", Require: plugin.Optional},
},
},
logger.Trace("Connecting to client") | ||
client := connect(ctx, d) | ||
|
||
if h.Item != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this if-else block for hydrate data, as it is not required here.
quals := d.KeyColumnQuals | ||
logger.Trace("Parsing key column quals", quals) | ||
fullName := quals["repository_full_name"].GetStringValue() | ||
sha := quals["tree_sha"].GetStringValue() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a check for empty values like below -
// check if fullName and sha is empty
if fullName == "" || sha == "" {
return nil, nil
}
tree := getResp.tree | ||
if tree != nil { | ||
logger.Trace("Returning tree", tree) | ||
return tree, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return tree, nil | |
d.StreamListItem(ctx, tree) |
logger.Trace("Returning tree", tree) | ||
return tree, nil | ||
} | ||
logger.Error("Nothing found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.Error("Nothing found") |
getResp := getResponse.(GetResponse) | ||
tree := getResp.tree | ||
if tree != nil { | ||
logger.Trace("Returning tree", tree) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.Trace("Returning tree", tree) |
Columns: []*plugin.Column{ | ||
// Top columns | ||
{Name: "repository_full_name", Type: proto.ColumnType_STRING, Transform: transform.FromQual("repository_full_name"), Description: "Full name of the repository"}, | ||
{Name: "tree_sha", Type: proto.ColumnType_STRING, Transform: transform.FromQual("tree_sha"), Description: "Tree SHA"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{Name: "tree_sha", Type: proto.ColumnType_STRING, Transform: transform.FromQual("tree_sha"), Description: "Tree SHA"}, | |
{Name: "sha", Type: proto.ColumnType_STRING, Transform: transform.FromQual("sha"), Description: "Tree SHA"}, |
quals := d.KeyColumnQuals | ||
logger.Trace("Parsing key column quals", quals) | ||
fullName := quals["repository_full_name"].GetStringValue() | ||
sha := quals["tree_sha"].GetStringValue() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sha := quals["tree_sha"].GetStringValue() | |
sha := quals["sha"].GetStringValue() |
@asfaltboy Hope you are doing good! Additionally, add a doc file (github_tree.md), example. Please let us know if you need any help. |
Hey @asfaltboy, please let us know if you have any questions or need any help with this PR, as we’d love to get your table in! |
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This PR was closed because it has been stalled for 90 days with no activity. |
'This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 30 days.' |
Example query results
Results