forked from alphagov/bulk-merger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
55 lines (41 loc) · 1.55 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require_relative "bulk_merger"
abort('abort: GITHUB_TOKEN not set in environment.') unless ENV['GITHUB_TOKEN']
desc "Confirm that you will release everything you merge"
task :confirm do
required_confirmation = "I promise to release everything I merge"
puts <<~CONFIRMATION
Bulk merging pull requests should only be done if you're willing to ensure
that every application is released to production.
This is useful for things like security patches, which need to be merged
across lots of applications quickly.
However, in most cases it's more sensible to approve, merge, and release each
application individually. This reduces the risk of having unreleased changes
on the main branch.
Please confirm that you understand this, and that you will release all the
things you've merged by typing exactly:
#{required_confirmation}
CONFIRMATION
confirmation = STDIN.gets.chomp
if confirmation == required_confirmation
puts "Okay then. You better do.\n"
else
abort "Please type exactly '#{required_confirmation}' to confirm"
end
end
desc "Just approve pull requests"
task :review do
BulkMerger.approve_unreviewed_pull_requests!
end
desc "Approve & merge pull requests"
task :merge => :confirm do
BulkMerger.approve_unreviewed_pull_requests!
BulkMerger.merge_approved_pull_requests!
end
desc "Merge approved pull requests, without reviewing"
task :merge_only => :confirm do
BulkMerger.merge_approved_pull_requests!
end
desc "List un-reviewed pull requests"
task :list do
BulkMerger.approve_unreviewed_pull_requests!(list: true)
end