File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -9,13 +9,14 @@ def self.refresh_baseline_if_configured
9
9
return unless should_download
10
10
11
11
puts "Downloading baseline file from gitlab"
12
- branch_name = CodeclimateDiff . configuration [ "gitlab" ] [ " main_branch_name"]
12
+ branch_name = CodeclimateDiff . configuration [ "main_branch_name" ]
13
13
project_id = CodeclimateDiff . configuration [ "gitlab" ] [ "project_id" ]
14
14
host = CodeclimateDiff . configuration [ "gitlab" ] [ "host" ]
15
- personal_access_token = CodeclimateDiff . configuration [ "gitlab" ] [ "personal_access_token" ]
15
+ baseline_filename = CodeclimateDiff . configuration [ "gitlab" ] [ "baseline_filename" ]
16
+ personal_access_token = ENV . fetch ( "CODECLIMATE_DIFF_GITLAB_PERSONAL_ACCESS_TOKEN" )
16
17
17
18
# curl --output codeclimate_diff_baseline.json --header "PRIVATE-TOKEN: MYTOKEN" "https://gitlab.digitalnz.org/api/v4/projects/85/jobs/artifacts/main/raw/codeclimate_diff_baseline.json?job=code_quality"
18
- url = "#{ host } /api/v4/projects/#{ project_id } /jobs/artifacts/#{ branch_name } /raw/codeclimate_diff_baseline.json ?job=code_quality"
19
+ url = "#{ host } /api/v4/projects/#{ project_id } /jobs/artifacts/#{ branch_name } /raw/#{ baseline_filename } ?job=code_quality"
19
20
response = RestClient . get ( url , { "PRIVATE-TOKEN" : personal_access_token } )
20
21
File . write ( "codeclimate_diff_baseline.json" , response . body )
21
22
rescue StandardError => e
Original file line number Diff line number Diff line change @@ -12,8 +12,10 @@ class Runner
12
12
def self . calculate_changed_filenames ( pattern )
13
13
extra_grep_filter = pattern ? " | grep '#{ pattern } '" : ""
14
14
branch_name = CodeclimateDiff . configuration [ "gitlab" ] [ "main_branch_name" ]
15
- files_changed = `git diff --name-only #{ branch_name } | grep --invert-match spec/ | grep --extended-regexp '.js$|.rb$'#{ extra_grep_filter } `
16
- files_changed . split ( "\n " )
15
+ files_changed_str = `git diff --name-only #{ branch_name } | grep --invert-match spec/ | grep --extended-regexp '.js$|.rb$'#{ extra_grep_filter } `
16
+ puts "Files changed on branch: #{ files_changed_str } "
17
+
18
+ files_changed_str . split ( "\n " )
17
19
end
18
20
19
21
def self . calculate_issues_in_changed_files ( changed_filenames )
You can’t perform that action at this time.
0 commit comments