File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,13 +9,14 @@ def self.refresh_baseline_if_configured
99 return unless should_download
1010
1111 puts "Downloading baseline file from gitlab"
12- branch_name = CodeclimateDiff . configuration [ "gitlab" ] [ " main_branch_name"]
12+ branch_name = CodeclimateDiff . configuration [ "main_branch_name" ]
1313 project_id = CodeclimateDiff . configuration [ "gitlab" ] [ "project_id" ]
1414 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" )
1617
1718 # 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"
1920 response = RestClient . get ( url , { "PRIVATE-TOKEN" : personal_access_token } )
2021 File . write ( "codeclimate_diff_baseline.json" , response . body )
2122 rescue StandardError => e
Original file line number Diff line number Diff line change @@ -12,8 +12,10 @@ class Runner
1212 def self . calculate_changed_filenames ( pattern )
1313 extra_grep_filter = pattern ? " | grep '#{ pattern } '" : ""
1414 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 " )
1719 end
1820
1921 def self . calculate_issues_in_changed_files ( changed_filenames )
You can’t perform that action at this time.
0 commit comments