Github
"GitHub is a development platform inspired by the way you work. From open source to business, you can host and review code, manage projects, and build software alongside 50 million developers." - https://github.com
"GitHub, Inc. is a provider of Internet hosting for software development and version control using Git. It offers the distributed version control and source code management (SCM) functionality of Git, plus its own features. It provides access control and several collaboration features such as bug tracking, feature requests, task management, continuous integration and wikis for every project. Headquartered in California, it has been a subsidiary of Microsoft since 2018." - https://en.wikipedia.org/wiki/GitHub
Tips
Get all public keys for a user
Append .keys
to the user profile URL, so https://github.com/danielhoherd becomes https://github.com/danielhoherd.keys. This is useful for adding to ~/.ssh/authorized_keys
Get a downloadable patch for a git commit
Append .patch
to a commit URL, so https://github.com/apache/airflow/commit/86e2ab53aff becomes https://github.com/apache/airflow/commit/86e2ab53aff.patch
Get a list of repositories for a user
This gives a list of repositories sorted by the last time they were pushed to.
curl -s https://api.github.com/users/danielhoherd/repos?per_page=200 |
jq -r '.[] | "\(.pushed_at) \(.html_url)"' |
sort -d |
nl
https://developer.github.com/v3/repos/
Add a collapsible section in markdown
Markdown supports adding HTML elements. One element that can be useful for hiding large chunks of data that are related to a comment but might drown it out is the <details>
element. This works in markdown documents, and PR and issue descriptions and comments.
<details>
<summary>Clickable thing that unfolds the details</summary>
whatever markdown you want
1. list item 1
2. list item 2
```py
import platform
platform.uname()
```
</details>
Show your API rate limits
gh api rate_limit
Links
- CLI interface: https://github.com/cli/cli
- Python API: https://github.com/PyGithub/PyGithub
- All issues in all repositories assigned to the logged in user
- All issues in all repositories assigned to the logged in user that are not in a project
Get a json file of the last 2000 issues in a repository
Using the gh
CLI:
gh issue list --state all --limit 2000 --json author,createdAt,title > issues.json