@@ -31,16 +31,12 @@ require "parsers/audit_parser"
3131
3232options = {
3333 config_path : ENV . fetch ( "INPUT_CONFIG_FILE" , ".github/importmap-updates.yml" ) ,
34- outdated_file : nil ,
35- audit_file : nil ,
3634 dry_run : %w[ true 1 yes ] . include? ( ENV [ "IMPORTMAP_DRY_RUN" ] . to_s . downcase )
3735}
3836
3937OptionParser . new do |opts |
4038 opts . banner = "Usage: importmap-update [options]"
4139 opts . on ( "-c" , "--config PATH" , "Path to config YAML" ) { |p | options [ :config_path ] = p }
42- opts . on ( "--outdated-file PATH" , "Captured `bin/importmap outdated` output" ) { |p | options [ :outdated_file ] = p }
43- opts . on ( "--audit-file PATH" , "Captured `bin/importmap audit` output" ) { |p | options [ :audit_file ] = p }
4440 opts . on ( "--dry-run" , "Do not perform side effects; log what would happen" ) { options [ :dry_run ] = true }
4541 opts . on ( "-h" , "--help" ) {
4642 puts opts
@@ -55,11 +51,8 @@ rescue Importmap::Update::Config::ConfigError => e
5551 exit 2
5652end
5753
58- missing = [ :outdated_file , :audit_file ] . select { |k | options [ k ] . nil? }
59- unless missing . empty?
60- warn "Missing required option(s): #{ missing . map { |k | "--#{ k . to_s . tr ( "_" , "-" ) } " } . join ( ", " ) } "
61- exit 2
62- end
54+ outdated_file = ENV . fetch ( "IMPORTMAP_OUTDATED_FILE" )
55+ audit_file = ENV . fetch ( "IMPORTMAP_AUDIT_FILE" )
6356
6457repo = ENV [ "GITHUB_REPOSITORY" ]
6558if repo . nil? || repo . empty?
@@ -82,8 +75,8 @@ git = Importmap::Update::GitClient.new(
8275 author_email : ENV . fetch ( "IMPORTMAP_AUTHOR_EMAIL" , "github-actions[bot]@users.noreply.github.com" )
8376)
8477
85- outdated_output = File . read ( options [ : outdated_file] )
86- audit_output = File . read ( options [ : audit_file] )
78+ outdated_output = File . read ( outdated_file )
79+ audit_output = File . read ( audit_file )
8780outdated = Importmap ::Update ::Parsers ::OutdatedParser . parse ( outdated_output )
8881vulnerabilities = Importmap ::Update ::Parsers ::AuditParser . parse ( audit_output )
8982plan = Importmap ::Update ::Planner . new (
0 commit comments