forked from oehme/travis-secrets-setter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
set-variables.rb
23 lines (20 loc) · 958 Bytes
/
set-variables.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'travis'
#organization = "IBM-Swift"
organization = "rolivieri"
puts "About to update public environment variable(s) in Travis CI jobs for organization '#{organization}'."
#Travis.access_token = Travis.github_auth(ENV['TRAVIS_TOKEN'])
Travis.access_token = Travis.github_auth(ENV['TRAVIS_TOKEN'])
repos = Travis::Repository.find_all(owner_name: organization)
.select{|repo| repo.slug == 'rolivieri/db-test'}
#.select{|repo| repo.slug == 'IBM-Swift/CloudConfiguration'}
#.select{|repo| repo.slug == 'rolivieri/db-test'}
#.reject{|repo| repo.slug == 'rolivieri/travis-secrets-setter'}
#.reject{|repo| repo.slug == 'rolivieri/get-started-swift'}
#.select{|repo| Travis.user.admin_access.include?(repo)}
keys = ['SWIFT_4_DEV_SNAPSHOT']
repos.each do |repo|
keys.each do |key|
puts "Setting env var '#{key}' to '#{ENV[key]}' on project '#{repo.slug}'"
repo.env_vars.upsert(key, "#{ENV[key]}", public: true)
end
end