This repository was archived by the owner on Mar 19, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +58
-7
lines changed Expand file tree Collapse file tree 2 files changed +58
-7
lines changed Original file line number Diff line number Diff line change 7
7
- uses : actions/checkout@v1
8
8
- name : Install dependency
9
9
run : pip install requests
10
- - name : Detect deployment
10
+ - name : Debug deployment
11
11
run :
12
- ./tools/ci/pr_preview.py
13
- --host http://api.github.com
14
- --github-project web-platform-tests/wpt-actions-test
15
- detect
16
- --target http://s92097608.onlinehome.us/tmp
17
- --timeout 600
12
+ ./tools/ci/debug_deploy.py
18
13
env :
19
14
GITHUB_TOKEN : ${{ secrets.DEPLOY_TOKEN }}
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+
3
+ import json
4
+ import os
5
+
6
+ import requests
7
+
8
+ def gh_request (method_name , url , body = None ):
9
+ github_token = os .environ .get ('GITHUB_TOKEN' )
10
+
11
+ kwargs = {
12
+ 'headers' : {
13
+ 'Authorization' : 'token {}' .format (github_token ),
14
+ 'Accept' : 'application/vnd.github.v3+json'
15
+ }
16
+ }
17
+ method = getattr (requests , method_name .lower ())
18
+
19
+ if body is not None :
20
+ kwargs ['json' ] = body
21
+
22
+ print 'Issuing request: {} {}' .format (method_name .upper (), url )
23
+ print 'Request body: {}' .format (json .dumps (kwargs , indent = 2 ))
24
+
25
+ resp = method (url , ** kwargs )
26
+
27
+ resp .raise_for_status ()
28
+
29
+ resp_body = resp .json ()
30
+ print 'Response status code: {}' .format (resp .status_code )
31
+ print 'Response body: {}' .format (json .dumps (resp_body , indent = 2 ))
32
+
33
+ return resp .json ()
34
+
35
+ with open (os .environ ['GITHUB_EVENT_PATH' ]) as handle :
36
+ data = json .loads (handle .read ())
37
+
38
+ print 'Event data: {}' .format (json .dumps (data , indent = 2 ))
39
+
40
+ url_base = 'https://api.github.com/repos/web-platform-tests/wpt-actions-test'
41
+
42
+ gh_request (
43
+ 'GET' ,
44
+ '{}/deployments/{}/statuses' .format (url_base , data ['deployment' ]['id' ])
45
+ )
46
+
47
+ gh_request (
48
+ 'POST' ,
49
+ '{}/deployments/{}/statuses' .format (url_base , data ['deployment' ]['id' ]),
50
+ {'state' : 'pending' }
51
+ )
52
+
53
+ gh_request (
54
+ 'GET' ,
55
+ '{}/deployments/{}/statuses' .format (url_base , data ['deployment' ]['id' ])
56
+ )
You can’t perform that action at this time.
0 commit comments