File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change 13
13
14
14
from __future__ import absolute_import , print_function , unicode_literals
15
15
16
+ import urllib2
17
+ import json
16
18
import subprocess
17
19
import sys
18
20
import os
19
21
22
+
20
23
def run_command (cmd , log_file = None ):
21
24
print ("Running: {}" .format (cmd ))
22
25
sys .stdout .flush ()
@@ -32,12 +35,18 @@ def run_command(cmd, log_file=None):
32
35
33
36
def get_dockerfiles ():
34
37
dockerfiles = []
35
- docker_dir = os .path .dirname (os .path .realpath (__file__ ))
36
- for root , dirs , files in os .walk (docker_dir ):
37
- for file in files :
38
- if file == "Dockerfile" :
39
- dockerfiles .append (root )
40
- dockerfiles .sort (reverse = True )
38
+ GITHUB_API_URL = "https://api.github.com"
39
+ response = urllib2 .urlopen ("{}/repos/{}/pulls/{}/files" .format (GITHUB_API_URL ,
40
+ os .environ ['ghprbGhRepository' ],
41
+ os .environ ['ghprbPullId' ]))
42
+ data = json .load (response )
43
+
44
+ for file_info in data :
45
+ filename = file_info ['filename' ]
46
+ print (filename )
47
+ if "Dockerfile" in filename :
48
+ file_dir = filename .replace ("Dockerfile" , "" )
49
+ dockerfiles .append (file_dir )
41
50
return dockerfiles
42
51
43
52
You can’t perform that action at this time.
0 commit comments