Class: Action
- Inherits:
-
Object
- Object
- Action
- Defined in:
- action/lib/action.rb
Overview
Main GitHub Action entry point.
Inputs are read from the environment (see action.yml). The action runs in
one of two mutually exclusive source modes:
* Xcode project mode - `xcode-project-path`
* Swift manifest mode - `package-manifest-paths` (+ optional
`package-resolved-paths`)
Defined Under Namespace
Classes: ModeError
Instance Method Summary collapse
-
#initialize(reporter_sink: GithubIntegration.new, checker_factory: SpmChecker) ⇒ Action
constructor
A new instance of Action.
- #run ⇒ Object
Constructor Details
#initialize(reporter_sink: GithubIntegration.new, checker_factory: SpmChecker) ⇒ Action
Returns a new instance of Action.
365 366 367 368 369 370 |
# File 'action/lib/action.rb', line 365 def initialize(reporter_sink: GithubIntegration.new, checker_factory: SpmChecker) @reporter_sink = reporter_sink @checker_factory = checker_factory @missing_resolved = [] @timings = nil end |
Instance Method Details
#run ⇒ Object
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'action/lib/action.rb', line 372 def run @timings = Timings.new @timings.start("Total") @missing_resolved = [] inputs = read_inputs ConfigPrinter.new(inputs).print @reporter_sink.configure(inputs) move_to_workspace checker = configure_checker(inputs) ApplyModeValidator.new(inputs).validate result = @timings.measure("Checks") { run_checks(checker, inputs) } applied_updates = apply_updates_if_requested(inputs, result.updates) @timings.finish("Total") reporter = report( report_payload(result, applied_updates), comment: inputs[:comment], comment_on_success: inputs[:comment_on_success] ) FailureHandler.new.fail_apply_errors(applied_updates) if applied_updates&.failed? = FailOnThreshold.(inputs[:fail_on], reporter) FailureHandler.new.fail_with() if puts("SPM version check completed successfully!") rescue SpmVersionUpdates::ConfigurationError, SpmVersionUpdates::FileNotFoundError => error FailureHandler.new.fail_with_error(error) rescue SpmVersionUpdates::ParseError => error FailureHandler.new.fail_with_parse_error(error) rescue SpmVersionUpdates::PolicyError => error FailureHandler.new.fail_with_policy_error(error) rescue StandardError => error FailureHandler.new.fail_with_unexpected_error(error) end |