Sha256: 53dc9a493905773f5d3fa23f75023e3749d7d47c69b61d52ef182445be8bc207
Contents?: true
Size: 1.15 KB
Versions: 5
Compression:
Stored size: 1.15 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'optparse' require 'colorize' require 'action' OptionParser.new do |parser| parser.version = File.read("#{__dir__}/../VERSION") parser.banner += ' workflows ...' parser.on('-n', '--newer', 'deal only with actions that have an update') do @newer = true end parser.on('-w', '--write', 'write updates back to workflow files') do @write = true end end.parse! ARGV.each do |path| puts path.magenta yaml = File.read(path) actions = Action.array_from_yaml(yaml) actions.each do |current_action| new_action = current_action.clone new_action.ref = current_action.latest_tag new_ref_str = new_action.ref.bold current_ref_str = current_action.ref.bold current_action_str = current_action.print_without_ref.cyan.bold if current_action == new_action next if @newer else new_ref_str = new_ref_str.green current_ref_str = current_ref_str.red end puts "#{current_action_str} : #{current_ref_str} ==> #{new_ref_str}" next unless @write yaml.gsub!(/#{current_action}/, new_action.to_s) File.open(path, 'w') { |f| f.puts yaml } end end
Version data entries
5 entries across 5 versions & 1 rubygems