Skip to content
代码片段 群组 项目
未验证 提交 2c8f9e77 编辑于 作者: Rémy Coutable's avatar Rémy Coutable
浏览文件

Don't checkout master when running gitlab-housekeeper


Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
上级 872bae86
No related branches found
No related tags found
无相关合并请求
...@@ -15,21 +15,17 @@ def initialize(logger:, branch_from: 'master') ...@@ -15,21 +15,17 @@ def initialize(logger:, branch_from: 'master')
@branch_from = branch_from @branch_from = branch_from
end end
def with_clean_state def with_clean_state(&block)
result = Shell.execute('git', 'stash') result = Shell.execute('git', 'stash')
stashed = !result.include?('No local changes to save') stashed = !result.include?('No local changes to save')
with_return_to_current_branch(stashed: stashed) do with_return_to_current_branch(stashed: stashed, &block)
checkout_branch(@branch_from)
yield
end
end end
def create_branch(change) def create_branch(change)
branch_name = branch_name(change.identifiers) branch_name = branch_name(change.identifiers)
Shell.execute("git", "branch", "-f", branch_name) Shell.execute("git", "branch", "-f", branch_name, @branch_from)
branch_name branch_name
end end
......
...@@ -68,9 +68,9 @@ def run ...@@ -68,9 +68,9 @@ def run
# If no merge request exists yet, create an empty one to allow keeps to use the web URL. # If no merge request exists yet, create an empty one to allow keeps to use the web URL.
unless @dry_run unless @dry_run
merge_reqeust = get_existing_merge_request(branch_name) || create(change, branch_name) merge_request = get_existing_merge_request(branch_name) || create(change, branch_name)
change.mr_web_url = merge_reqeust['web_url'] change.mr_web_url = merge_request['web_url']
end end
git.in_branch(branch_name) do git.in_branch(branch_name) do
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册