LoginSignup
0
0

More than 5 years have passed since last update.

全てのリポジトリの作成日時・最終更新日時を得る

Posted at

はじめに

組織内のリポジトリの情報を俯瞰したくて GitHub を API で使ってみました。そのメモです。
まったく再利用性が無いですが、悪しからず。

欲しかった情報

  • リポジトリの一覧
  • 各リポジトリの作成日時
  • 各リポジトリの最終更新日時

利用した API

省略。さーせん。
本当は API ID とか API Version とか整理されていると良いと思います。

スニペッツ

言う必要はないと思いますが、下記はプレースホルダです。

文字列 内容
hogehoge トークン
nekomata 組織名

一覧を得る

#!/bin/sh

token=hogehoge

url='https://api.github.com/orgs/nekomata/repos?per_page=100'


curl -u ":$token" "$url&page=1" > rep-list-page-01.json
curl -u ":$token" "$url&page=2" > rep-list-page-02.json
curl -u ":$token" "$url&page=3" > rep-list-page-03.json

そーです、リポジトリ数の取得の方法については今回は調べていません。web page に表示されるんで。

リポジトリのサマリを得る

#!/bin/sh

name=$1

token=hogehoge

url='https://api.github.com/repos/nekomata'


curl -u ":$token" "$url/$name" > summary-$name.json

トークンについて

上記 API についてはリポジトリのアクセス権だけで十分です。

0
0
0

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
0
0