This repository was archived by the owner on Sep 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +24
-18
lines changed Expand file tree Collapse file tree 3 files changed +24
-18
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
- import requests
4
3
import os
5
4
5
+ import requests
6
+
6
7
7
8
def job1 () -> bool :
8
9
a = requests .request (
9
- "GET" ,
10
- f"https://api.github.com/repos/is-a-dev/orangcapp/pulls/{ os .environ ["PR_NUMBER" ]} " ,
11
- headers = {"Accept" : "application/vnd.github+json" },
12
- timeout = 60
13
- ).json ()
10
+ "GET" ,
11
+ f"https://api.github.com/repos/is-a-dev/orangcapp/pulls/{ os .environ ["PR_NUMBER" ]} " ,
12
+ headers = {"Accept" : "application/vnd.github+json" },
13
+ timeout = 60 ,
14
+ ).json ()
15
+
16
+ return a ["user" ]["login" ] == os .environ ["LINT_CODE" ]
14
17
15
- return a ['user' ]['login' ] == os .environ ["LINT_CODE" ]
16
18
17
19
result_1 = job1 ()
18
20
21
+
19
22
def job2 () -> bool :
20
23
a = requests .request (
21
- "GET" ,
22
- f"https://api.github.com/repos/is-a-dev/orangcapp/pulls/{ os .environ ["PR_NUMBER" ]} /reviews" ,
23
- headers = {"Accept" : "application/vnd.github+json" },
24
- timeout = 60
25
- ).json ()
26
-
27
- l = [x for x in a if x ['user' ]['login' ] == os .environ ["LINT_CODE" ] and x ['state' ] == "APPROVED" ]
24
+ "GET" ,
25
+ f"https://api.github.com/repos/is-a-dev/orangcapp/pulls/{ os .environ ["PR_NUMBER" ]} /reviews" ,
26
+ headers = {"Accept" : "application/vnd.github+json" },
27
+ timeout = 60 ,
28
+ ).json ()
29
+
30
+ l = [
31
+ x
32
+ for x in a
33
+ if x ["user" ]["login" ] == os .environ ["LINT_CODE" ] and x ["state" ] == "APPROVED"
34
+ ]
28
35
return len (l ) > 0
29
36
30
- result_2 = job2 ()
31
37
38
+ result_2 = job2 ()
32
39
33
- if not (result_1 or result_2 ): raise Exception
34
40
41
+ if not (result_1 or result_2 ):
42
+ raise Exception
Original file line number Diff line number Diff line change 29
29
env :
30
30
PR_NUMBER : ${{ github.event.number }}
31
31
LINT_CODE : ${{ secrets.LINT_CODE }}
32
-
Original file line number Diff line number Diff line change 36
36
- id : trailing-whitespace
37
37
name : Check for trailing whitespace.
38
38
args : [--markdown-linebreak-ext=md]
39
-
You can’t perform that action at this time.
0 commit comments