turbot / steampipe-plugin-github

Use SQL to instantly query repositories, users, gists and more from GitHub. Open source CLI. No DB required.
https://hub.steampipe.io/plugins/turbot/github
Apache License 2.0
72 stars 28 forks source link

Add table `github_blob` #430

Closed rmhartog closed 3 months ago

rmhartog commented 4 months ago

Add the table github_blob

Allows the github blobs to be joined to a github tree to access a specific file's contents, for example to check for configuration files or README's.

Example query results

select
  tree_sha,
  truncated,
  path,
  mode,
  type,
  sha,
  decode(content, encoding) as content
from
  github_tree t
left outer join
  github_blob b on b.repository_full_name = t.repository_full_name and b.blob_sha = t.sha
where
  t.repository_full_name = 'turbot/steampipe'
  and tree_sha = '0f200416c44b8b85277d973bff933efa8ef7803a'
  and path = 'Makefile';
Results ``` +------------------------------------------+-----------+----------+--------+------+------------------------------------------+-------------------------------------------+ | tree_sha | truncated | path | mode | type | sha | content | +------------------------------------------+-----------+----------+--------+------+------------------------------------------+-------------------------------------------+ | 0f200416c44b8b85277d973bff933efa8ef7803a | false | Makefile | 100644 | blob | 4650745ea73b4769919e29f3882a05d1351e2212 | | | | | | | | | steampipe: | | | | | | | | go build -o /usr/local/bin/steampipe | | | | | | | | | | | | | | | | dashboard_assets: | | | | | | | | $(MAKE) -C ui/dashboard | | | | | | | | | | | | | | | | all: | | | | | | | | $(MAKE) -C pluginmanager | | | | | | | | $(MAKE) -C ui/dashboard | | | | | | | | go build -o /usr/local/bin/steampipe | | | | | | | | | +------------------------------------------+-----------+----------+--------+------+------------------------------------------+-------------------------------------------+ ```
rmhartog commented 4 months ago

The current approach is a single call per blob, which is limited when it comes to rate limiting.

misraved commented 4 months ago

Welcome to Steampipe @rmhartog and thank you so much for raising the PR for a new table 👍.