Commit 17583cb 1 parent 5ade3dd commit 17583cb Copy full SHA for 17583cb
File tree 2 files changed +55
-0
lines changed
pages/waitingForMaintainer
2 files changed +55
-0
lines changed Original file line number Diff line number Diff line change 47
47
- name : GITHUB_TOKEN
48
48
value :
49
49
$$env : GITHUB_TOKEN
50
+ - name : waitingForMaintainer2
51
+ mode : query
52
+ query :
53
+ function : queryGitHubSearchAPI.ts#queryGitHubSearchAPI
54
+ kind : local
55
+ parameters :
56
+ - name : queryInput
57
+ value :
58
+ $$jsExpression : ' `is:issue repo:mui/${page.parameters.repository}
59
+ label:\\"status: waiting for maintainer\\"`'
50
60
display : shell
51
61
alias :
52
62
- hj1i3hqe
Original file line number Diff line number Diff line change
1
+ /* eslint-disable import/prefer-default-export */
2
+ import { rawRequest } from 'graphql-request' ;
3
+
4
+ export async function queryGitHubSearchAPI ( queryInput = '' , type = 'ISSUE' ) {
5
+ if ( ! process . env . GITHUB_TOKEN ) {
6
+ throw new Error ( `Env variable GITHUB_TOKEN not configured` ) ;
7
+ }
8
+
9
+ const endpoint = 'https://api.github.com/graphql' ;
10
+ const token = process . env . GITHUB_TOKEN ;
11
+
12
+ // https://docs.github.com/en/graphql/reference/queries#search
13
+ // 5,000 requests/hr rate limit https://docs.github.com/en/graphql/overview/rate-limits-and-node-limits-for-the-graphql-api#primary-rate-limit
14
+ // vs. https://docs.github.com/en/rest/search/search?apiVersion=2022-11-28#rate-limit
15
+ // with 30 requests/minutes or 1,800 request/hr.
16
+ const query = `
17
+ {
18
+ search(query: "${ queryInput } ", type: ${ type } , first: 100) {
19
+ issueCount
20
+ nodes {
21
+ ... on PullRequest {
22
+ number
23
+ state
24
+ labels(first: 10, orderBy: { direction: DESC, field: CREATED_AT }) {
25
+ nodes {
26
+ name
27
+ }
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
33
+ ` ;
34
+
35
+ const response = await rawRequest < any > (
36
+ endpoint ,
37
+ query ,
38
+ { } ,
39
+ {
40
+ Authorization : `Bearer ${ token } ` ,
41
+ } ,
42
+ ) ;
43
+
44
+ return response . data . search ;
45
+ }
You can’t perform that action at this time.
0 commit comments