LoginSignup
4

More than 5 years have passed since last update.

GitHub 組織配下のリポジトリ横断検索

Last updated at Posted at 2017-11-24

DBの構成変更する時に、関連するシステムがわからんわいってなった。

バージョン

Github

REST API v3
https://developer.github.com/v3/

1. tokenを発行する

※認証方法は他にもある
 https://developer.github.com/v3/auth/

2. 以下のコマンドを打つ

curl -H 'Accept: application/vnd.github.v3.text-match+json' \
    -u ユーザ名:トークン https://api.github.com/search/code?q=検索文字列+in:file+org:組織名

https://developer.github.com/v3/search/#search-code
→ org使えるとは書いてないけれど、使えるっぽい動きだった

https://help.github.com/articles/searching-code/
→ org使えるって書いてある

3. おまけ

日本語を検索する時は、URLエンコードすれば良いらしい

例) 日本語→%e6%97%a5%e6%9c%ac%e8%aa%9e

curl -H 'Accept: application/vnd.github.v3.text-match+json' \
    -u ユーザ名:トークン https://api.github.com/search/code?q=%e6%97%a5%e6%9c%ac%e8%aa%9e+in:file+org:組織名

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4