Skip to content

hashdeps/github-pr-overview

GitHub Pull Request Overview block

Entity Data

This block is capable of resolving and displaying pull request related data from the following GitHub API streams:

  • Pull Requests with an EntityType with the name GithubPullRequest
  • Reviews with an EntityType with the name GithubReview
  • Issue Events with an EntityType GithubIssueEvent

Updating the Example Graph

It's possible to download new data for the example graph by querying the GitHub API manually. An example of doing this using the GitHub CLI:

gh api \
  -H "Accept: application/vnd.github+json" \
  /repos/blockprotocol/blockprotocol/issues/ISSUE_NUMBER/events

gh api \
  -H "Accept: application/vnd.github+json" \
  /repos/blockprotocol/blockprotocol/pulls/PULL_NUMBER

gh api \
  -H "Accept: application/vnd.github+json" \
  /repos/blockprotocol/blockprotocol/pulls/PULL_NUMBER/reviews

The output then needs to be modified to fit the specification. This can be done through any number of ways, a short Python example is as follows:

from pathlib import Path
import uuid
import json

def main():
    contents = json.loads(Path("issue_events.json").read_text())
    modified = []
    for entry in contents:
        modified.append({
            "entityId": str(uuid.uuid4()),
            "entityTypeId": "GithubIssueEventType",
            "properties": entry
        })

    Path("ssue_events_updated.json").write_text(json.dumps(modified))


if __name__ == "__main__":
    main()

About

Block: GitHub Pull-Request Overview

Resources

License

Unknown and 2 other licenses found

Licenses found

Unknown
LICENSE.md
Apache-2.0
LICENSE-APACHE.md
MIT
LICENSE-MIT.md

Stars

Watchers

Forks

Contributors

Languages