feat: add github token in application.yml

This commit is contained in:
Adrien Waksberg 2018-08-04 08:19:58 +02:00
parent 2c28c02673
commit 78a248286f
4 changed files with 12 additions and 3 deletions

2
.gitignore vendored
View file

@ -28,3 +28,5 @@
# Ignore master key for decrypting credentials and more.
/config/master.key
/config/application.yml

View file

@ -3,6 +3,8 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.4.1'
gem 'figaro'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'
# Use sqlite3 as the database for Active Record

View file

@ -76,6 +76,8 @@ GEM
erubi (1.7.1)
execjs (2.7.0)
ffi (1.9.25)
figaro (1.1.1)
thor (~> 0.14)
globalid (0.4.1)
activesupport (>= 4.2.0)
i18n (1.0.1)
@ -197,6 +199,7 @@ DEPENDENCIES
capybara (>= 2.15, < 4.0)
chromedriver-helper
coffee-rails (~> 4.2)
figaro
jbuilder (~> 2.5)
listen (>= 3.0.5, < 3.2)
puma (~> 3.11)

View file

@ -16,13 +16,15 @@ namespace :repositories do
desc 'Update version from github repositories'
task github: :environment do
headers = {
'Accept' => 'application/vnd.github.v3+json'
}
headers['Authorization'] = "token #{Figaro.env.github_token}" if Figaro.env.github_token
GithubRepository.all.each do |repo|
begin
software = Software.find(repo.software_id)
versions = software.versions.all.map(&:number)
headers = {
'Accept' => 'application/vnd.github.v3+json'
}
tags =
JSON.parse(
get_url_content(