Commit 8fb2f86
Changed files (10)
src/collect/commits.graphql
@@ -1,43 +0,0 @@
-query CommitsQuery(
- $owner: String!
- $name: String!
- $author: ID!
- $num: Int = 100
- $cursor: String
-) {
- repository(owner: $owner, name: $name) {
- defaultBranchRef {
- target {
- ... on Commit {
- history(first: $num, after: $cursor, author: { id: $author }) {
- totalCount
- nodes {
- sha: oid
- committedDate
- message
- messageBody
- additions
- deletions
- repository {
- owner {
- login
- }
- name
- }
- }
- pageInfo {
- hasNextPage
- endCursor
- }
- }
- }
- }
- }
- }
- rateLimit {
- limit
- cost
- remaining
- resetAt
- }
-}
src/collect/commits.ts
@@ -1,3 +1,49 @@
+export const commitsQuery = `#graphql
+query CommitsQuery(
+ $owner: String!
+ $name: String!
+ $author: ID!
+ $num: Int = 100
+ $cursor: String
+) {
+ repository(owner: $owner, name: $name) {
+ defaultBranchRef {
+ target {
+ ... on Commit {
+ history(first: $num, after: $cursor, author: { id: $author }) {
+ totalCount
+ nodes {
+ sha: oid
+ committedDate
+ message
+ messageBody
+ additions
+ deletions
+ repository {
+ owner {
+ login
+ }
+ name
+ }
+ }
+ pageInfo {
+ hasNextPage
+ endCursor
+ }
+ }
+ }
+ }
+ }
+ }
+ rateLimit {
+ limit
+ cost
+ remaining
+ resetAt
+ }
+}
+`
+
export type CommitsQuery = {
repository: {
defaultBranchRef: {
src/collect/issues.graphql
@@ -1,49 +0,0 @@
-query IssuesQuery($username: String!, $num: Int = 100, $cursor: String) {
- user(login: $username) {
- issues(first: $num, after: $cursor, filterBy: { createdBy: $username }) {
- totalCount
- nodes {
- createdAt
- closedAt
- closed
- author {
- login
- }
- number
- title
- labels(first: 10) {
- totalCount
- nodes {
- name
- }
- }
- body
- comments(first: 1) {
- totalCount
- }
- reactions(first: 10) {
- totalCount
- }
- assignees(first: 3) {
- totalCount
- }
- repository {
- owner {
- login
- }
- name
- }
- }
- pageInfo {
- hasNextPage
- endCursor
- }
- }
- }
- rateLimit {
- limit
- cost
- remaining
- resetAt
- }
-}
src/collect/issues.ts
@@ -1,3 +1,57 @@
+import { Extra } from './types.js'
+
+export const issuesQuery = `#graphql
+query IssuesQuery($username: String!, $num: Int = 100, $cursor: String) {
+ user(login: $username) {
+ issues(first: $num, after: $cursor, filterBy: { createdBy: $username }) {
+ totalCount
+ nodes {
+ createdAt
+ closedAt
+ closed
+ author {
+ login
+ }
+ number
+ title
+ labels(first: 10) {
+ totalCount
+ nodes {
+ name
+ }
+ }
+ body
+ comments(first: 1) {
+ totalCount
+ }
+ reactions(first: 10) {
+ totalCount
+ }
+ assignees(first: 3) {
+ totalCount
+ }
+ repository {
+ owner {
+ login
+ }
+ name
+ }
+ }
+ pageInfo {
+ hasNextPage
+ endCursor
+ }
+ }
+ }
+ rateLimit {
+ limit
+ cost
+ remaining
+ resetAt
+ }
+}
+`
+
export type IssuesQuery = {
user: {
issues: {
@@ -6,6 +60,7 @@ export type IssuesQuery = {
createdAt: string
closedAt: string
closed: boolean
+ closedBy: Extra<string>
author: {
login: string
}
src/collect/pulls.graphql
@@ -1,70 +0,0 @@
-query PullsQuery($username: String!, $num: Int = 100, $cursor: String) {
- user(login: $username) {
- pullRequests(first: $num, after: $cursor) {
- totalCount
- nodes {
- createdAt
- number
- title
- body
- closed
- merged
- mergedAt
- mergedBy {
- login
- }
- repository {
- owner {
- login
- }
- name
- }
- participants(first: 20) {
- totalCount
- nodes {
- login
- }
- }
- lastCommit: commits(last: 1) {
- nodes {
- commit {
- checkSuites(first: 20) {
- totalCount
- nodes {
- app {
- name
- }
- workflowRun {
- workflow {
- name
- }
- }
- lastCheckRun: checkRuns(last: 1) {
- totalCount
- nodes {
- name
- conclusion
- status
- startedAt
- completedAt
- }
- }
- }
- }
- }
- }
- }
- }
- pageInfo {
- hasNextPage
- endCursor
- }
- }
- }
- rateLimit {
- limit
- cost
- remaining
- resetAt
- }
-}
src/collect/pulls.ts
@@ -1,3 +1,76 @@
+export const pullsQuery = `#graphql
+query PullsQuery($username: String!, $num: Int = 100, $cursor: String) {
+ user(login: $username) {
+ pullRequests(first: $num, after: $cursor) {
+ totalCount
+ nodes {
+ createdAt
+ number
+ title
+ body
+ closed
+ merged
+ mergedAt
+ mergedBy {
+ login
+ }
+ repository {
+ owner {
+ login
+ }
+ name
+ }
+ participants(first: 20) {
+ totalCount
+ nodes {
+ login
+ }
+ }
+ lastCommit: commits(last: 1) {
+ nodes {
+ commit {
+ checkSuites(first: 20) {
+ totalCount
+ nodes {
+ app {
+ name
+ }
+ workflowRun {
+ workflow {
+ name
+ }
+ }
+ lastCheckRun: checkRuns(last: 1) {
+ totalCount
+ nodes {
+ name
+ conclusion
+ status
+ startedAt
+ completedAt
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ pageInfo {
+ hasNextPage
+ endCursor
+ }
+ }
+ }
+ rateLimit {
+ limit
+ cost
+ remaining
+ resetAt
+ }
+}
+`
+
export type PullsQuery = {
user: {
pullRequests: {
src/collect/types.ts
@@ -0,0 +1,1 @@
+export type Extra<T> = T | undefined
src/collect/user.graphql
@@ -1,59 +0,0 @@
-query UserQuery($login: String!) {
- user(login: $login) {
- id
- login
- name
- avatarUrl
- bio
- company
- location
- email
- twitterUsername
- websiteUrl
- status {
- createdAt
- emoji
- message
- }
- createdAt
- followers {
- totalCount
- }
- following {
- totalCount
- }
- anyPinnableItems
- pinnedItems(first: 6) {
- totalCount
- nodes {
- ... on Gist {
- name
- }
- ... on Repository {
- name
- }
- }
- }
- sponsoring {
- totalCount
- }
- sponsors {
- totalCount
- }
- starredRepositories {
- totalCount
- }
- publicKeys(first: 5) {
- totalCount
- nodes {
- key
- }
- }
- }
- rateLimit {
- limit
- cost
- remaining
- resetAt
- }
-}
src/collect/user.ts
@@ -1,3 +1,65 @@
+export const userQuery = `#graphql
+query UserQuery($login: String!) {
+ user(login: $login) {
+ id
+ login
+ name
+ avatarUrl
+ bio
+ company
+ location
+ email
+ twitterUsername
+ websiteUrl
+ status {
+ createdAt
+ emoji
+ message
+ }
+ createdAt
+ followers {
+ totalCount
+ }
+ following {
+ totalCount
+ }
+ anyPinnableItems
+ pinnedItems(first: 6) {
+ totalCount
+ nodes {
+ ... on Gist {
+ name
+ }
+ ... on Repository {
+ name
+ }
+ }
+ }
+ sponsoring {
+ totalCount
+ }
+ sponsors {
+ totalCount
+ }
+ starredRepositories {
+ totalCount
+ }
+ publicKeys(first: 5) {
+ totalCount
+ nodes {
+ key
+ }
+ }
+ }
+ rateLimit {
+ limit
+ cost
+ remaining
+ resetAt
+ }
+}
+`
+
export type UserQuery = {
user: {
id: string
package.json
@@ -11,8 +11,7 @@
"fmt:check": "prettier --check .",
"start": "tsc --watch",
"tsc": "tsc",
- "build": "npm run copy-files && npm run tsc",
- "copy-files": "copyfiles -u 1 src/**/*.graphql dist/",
+ "build": "tsc",
"check-images": "node dist/check-images.js",
"test": "npm run test:unit",
"test:unit": "c8 -r lcov -r text -o coverage -x scripts -x test node --loader ts-node/esm --experimental-specifier-resolution=node scripts/test.mjs"
@@ -28,7 +27,6 @@
"@types/minimist": "^1.2.3",
"@types/node": "^20.8.0",
"c8": "^8.0.1",
- "copyfiles": "^2.4.1",
"fast-glob": "^3.3.1",
"prettier": "^3.0.3",
"ts-node": "^10.9.1",