Skip to content
This repository has been archived by the owner on Sep 6, 2022. It is now read-only.

Commit

Permalink
Merge pull request #603 from fastlane/remove-nil-triggers
Browse files Browse the repository at this point in the history
Remove nil triggers
  • Loading branch information
taquitos authored Apr 5, 2018
2 parents 5deb6ea + fc86ea0 commit da08832
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions app/features/project/project_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,18 @@ class ProjectController < AuthenticatedControllerBase
hour = params["hour"]
minute = params["minute"]

# TODO: Until we make a proper interface to attach JobTriggers to a Project, let's add a manual one for the
# selected branch.
triggers_to_add = [FastlaneCI::ManualJobTrigger.new(branch: branch)]

case trigger_type
when FastlaneCI::JobTrigger::TRIGGER_TYPE[:commit]
trigger = FastlaneCI::CommitJobTrigger.new(branch: branch)
triggers_to_add << FastlaneCI::CommitJobTrigger.new(branch: branch)
when FastlaneCI::JobTrigger::TRIGGER_TYPE[:manual]
logger.debug("Manual trigger selected - this is enabled by default")
# Nothing to do here, manual trigger is added by default
when FastlaneCI::JobTrigger::TRIGGER_TYPE[:nightly]
trigger = FastlaneCI::NightlyJobTrigger.new(branch: branch, hour: hour.to_i, minute: minute.to_i)
triggers_to_add << FastlaneCI::NightlyJobTrigger.new(branch: branch, hour: hour.to_i, minute: minute.to_i)
else
raise "Couldn't create a JobTrigger"
end
Expand All @@ -214,12 +218,7 @@ class ProjectController < AuthenticatedControllerBase
enabled: true,
platform: lane.split(" ").first,
lane: lane.split(" ").last,
# TODO: Until we make a proper interface to attach JobTriggers to a Project, let's add a manual one for the
# selected branch.
job_triggers: [
trigger,
FastlaneCI::ManualJobTrigger.new(branch: branch)
]
job_triggers: triggers_to_add
)

if !project.nil?
Expand Down

0 comments on commit da08832

Please sign in to comment.