GitHub GraphQL APIでApproveとCheckのステータスを取得する
クエリ
{ search(type: ISSUE, last: 100, query: "is:open is:pr author:@me org:qubole") { nodes { ... on PullRequest { title url reviewDecision commits(last: 1) { nodes { commit { statusCheckRollup { state } } } } } } } }
結果
{ "data": { "search": { "nodes": [ { "title": "Fix or skip deepsource check in commands.py", "url": "https://github.com/qubole/qds-sdk-py/pull/341", "reviewDecision": "REVIEW_REQUIRED", "commits": { "nodes": [ { "commit": { "statusCheckRollup": { "state": "SUCCESS" } } } ] } } ] } } }
cf.
SwiftのCLIでGitHub APIをたたく
GitHub - winebarrel/swift-octokit-cli-example
// let package = Package( // name: "octokit-cli", // platforms: [ // .macOS(.v14), // ], import Foundation import OctoKit let env = ProcessInfo.processInfo.environment let token = env["GITHUB_TOKEN"]! let config = TokenConfiguration(token) let octokit = Octokit(config) let user = try! await octokit.me() print(user.name!) // async未対応の場合 let ns = try! await withCheckedThrowingContinuation { continuation in octokit.myNotifications { response in switch response { case let .success(notifications): continuation.resume(returning: notifications) case let .failure(error): continuation.resume(throwing: error) } } } for n in ns { print(n.subject.title!) }
Datadogの月ごとの使用量を出すツールを作った
料金じゃなくて量のほう。 月額プランのコミットが量に対してなので、ぱっと見れるように作った。