Skip to content

Commit 7b83dfb

Browse files
feat: switched to yaml config
1 parent 913ab75 commit 7b83dfb

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@
99

1010
# rspec failure tracking
1111
.rspec_status
12+
.codeclimate_diff.yml

lib/codeclimate_diff/downloader.rb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
# frozen_string_literal: true
22

33
require "rest-client"
4+
require "yaml"
45

56
module CodeclimateDiff
67
class Downloader
78

89
def self.refresh_baseline_if_configured
9-
should_download = CodeclimateDiff.configuration.gitlab[:download_baseline_from_pipeline]
10+
11+
config = YAML.load_file("./.codeclimate_diff.yml")
12+
13+
puts config
14+
15+
should_download = config['gitlab']['download_baseline_for_pipeline']
1016
return unless should_download
1117

12-
branch_name = CodeclimateDiff.configuration.gitlab[:main_branch_name]
13-
project_id = CodeclimateDiff.configuration.gitlab[:project_id]
14-
host = CodeclimateDiff.configuration.gitlab[:host]
15-
personal_access_token = CodeclimateDiff.configuration.gitlab[:personal_access_token]
18+
puts "downloading baseline file from gitlab"
19+
branch_name = config['gitlab']['main_branch_name']
20+
project_id = config['gitlab']['project_id']
21+
host = config['gitlab']['host']
22+
personal_access_token = config['gitlab']['personal_access_token']
1623

1724
# 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"
1825
url = "#{host}/api/v4/projects/#{project_id}/jobs/artifacts/#{branch_name}/raw/codeclimate_diff_baseline.json?job=code_quality"

0 commit comments

Comments
 (0)