Skip to content

Commit 777eb86

Browse files
committed
Use regex for allow list of sync branches
1 parent 85f1351 commit 777eb86

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

cgi-bin/webhook.cgi

+2-7
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ class Webhook
6262
end
6363

6464
class PushHook
65-
RUBY_SYNCED_REFS = %w[
66-
refs/heads/master
67-
refs/heads/ruby_2_7
68-
refs/heads/ruby_3_0
69-
refs/heads/ruby_3_1
70-
]
7165
DEFAULT_GEM_REPOS = %w[
7266
abbrev
7367
base64
@@ -170,7 +164,8 @@ class PushHook
170164
end
171165

172166
def on_push_ruby(ref, pusher:)
173-
if RUBY_SYNCED_REFS.include?(ref) && pusher != 'matzbot' # matzbot should stop an infinite loop here.
167+
# Allow to sync like ruby_3_0, ruby_3_1, and master branches.
168+
if (ref == "refs/heads/master" || ref =~ /refs\/heads\/ruby_\d_\d/) && pusher != 'matzbot' # matzbot should stop an infinite loop here.
174169
# www-data user is allowed to sudo `/home/git/git.ruby-lang.org/bin/update-ruby.sh`.
175170
execute('/home/git/git.ruby-lang.org/bin/update-ruby.sh', File.basename(ref), user: 'git')
176171
else

0 commit comments

Comments
 (0)