Skip to content

Commit

Permalink
Reject set_flags step when restoring projects after a PR was reopend
Browse files Browse the repository at this point in the history
There is no project that should be restored for the set_flags step in a workflow,
when a PR is reopened on the SCM. There for it should be one of the steps that gets
rejected when restoring. This will also fix an issue, since the target_project_name method
of the SetFlags is private and expects to get passed a keyword argument, which all
other steps don't.

Fixes #13338
  • Loading branch information
krauselukas committed Feb 8, 2023
1 parent 96eb354 commit 7fa8ce3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api/app/models/workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ def restore_target_projects
token_user_login = token.executor.login

# Do not process steps for which there's nothing to do
processable_steps = steps.reject { |step| step.instance_of?(::Workflow::Step::ConfigureRepositories) || step.instance_of?(::Workflow::Step::RebuildPackage) }
processable_steps = steps.reject do |step|
step.instance_of?(::Workflow::Step::ConfigureRepositories) || step.instance_of?(::Workflow::Step::RebuildPackage) || step.instance_of?(::Workflow::Step::SetFlags)
end
target_project_names = processable_steps.map(&:target_project_name).uniq.compact
target_project_names.each do |target_project_name|
Project.restore(target_project_name, user: token_user_login)
Expand Down

0 comments on commit 7fa8ce3

Please sign in to comment.