使用GraphQL查询(
GitHub API v4
)还有
ContributionsCollection
对象
定义
from
通过
now
减去一年,然后
to
通过
现在
.
var to = new Date();
var year = to.getFullYear();
var month = to.getMonth();
var day = to.getDate();
var from = new Date(year - 1, month, day);
使用
graphql.js
然后打电话
in here
:
query ContributionsView($username: String!, $from: DateTime!, $to: DateTime!) {
user(login: $username) {
contributionsCollection(from: $from, to: $to) {
totalCommitContributions
totalIssueContributions
totalPullRequestContributions
totalPullRequestReviewContributions
}
}
}
一旦脚本在你的博客页面外运行,
you can include it
用一个
<script src=...>
要素