File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 6
6
import logging
7
7
import os
8
8
import shutil
9
+ import git
9
10
10
11
from megalinter import Reporter , config , utils
11
12
@@ -63,6 +64,19 @@ def produce_report(self):
63
64
f" in folder { updated_sources_dir } .\n "
64
65
"Download it from artifacts then copy-paste it in your local repo to apply linters updates"
65
66
)
67
+
68
+ if not config .exists (self .master .request_id , "GITHUB_REPOSITORY" ):
69
+ apply_fixes = config .get_list (self .master .request_id , "APPLY_FIXES" , "none" )
70
+ if apply_fixes .lower () != "none" :
71
+ try :
72
+ repo = git .Repo (os .path .realpath (self .master .github_workspace ))
73
+ repo .git .add (update = True )
74
+ repo .git .commit ("megalinter auto fixes" )
75
+ repo .git .push
76
+ except Exception as exp :
77
+ logging .error (
78
+ "[Updated Sources Reporter] Failed to git push auto fixes: " + str (exp .message )
79
+ )
66
80
else :
67
81
logging .info (
68
82
"[Updated Sources Reporter] No source file has been formatted or fixed"
You can’t perform that action at this time.
0 commit comments