Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream vs rOpenSci #2

Draft
wants to merge 193 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
193 commits
Select commit Hold shift + click to select a range
7b6257f
coc tweaks
maelle Jan 19, 2021
a2df283
add command
maelle Jan 29, 2021
ec585f8
add team ID
maelle Jan 29, 2021
56b2790
add team ID
maelle Jan 29, 2021
0207c9f
add team ID
maelle Jan 29, 2021
9145cfc
tweaks
maelle Jan 29, 2021
81a84ae
tweaks
maelle Jan 29, 2021
0dde011
tweaks
maelle Jan 29, 2021
f0a136c
tweaks
maelle Jan 29, 2021
8957620
tweaks
maelle Jan 29, 2021
f4a342a
tweaks
maelle Jan 29, 2021
4d486d8
add approved
maelle Feb 3, 2021
85cb0e2
add approved
maelle Feb 3, 2021
bbcf3e0
add approved
maelle Feb 3, 2021
c84c970
add approved
maelle Feb 3, 2021
b425e5e
Custom reviewer responder (#4)
xuanxu Feb 24, 2021
d73dbfa
Update reviewers_due_date_responder_spec.rb (#5)
maelle Feb 24, 2021
5f777a6
rm maelle (#6)
maelle Feb 24, 2021
3515ec5
New reviewer responder docs (#7)
xuanxu Feb 24, 2021
cffdb3f
Update settings-production.yml
maelle Mar 11, 2021
20f8b43
start adding gp
maelle Mar 19, 2021
0d63357
start adding gp
maelle Mar 19, 2021
6bfd30f
start adding gp
maelle Mar 19, 2021
6304545
start adding gp
maelle Mar 19, 2021
1b0edd0
add a label removal cc @annakrystalli
maelle Mar 22, 2021
d4dff2e
Update settings-production.yml
maelle Mar 22, 2021
af62b48
Update settings-production.yml
maelle Apr 9, 2021
15fed17
update external service: gp -> editorcheck
mpadge Apr 27, 2021
2a89ec7
update external service: gp -> editorcheck (#11)
mpadge Apr 27, 2021
20e3767
Merge branch 'ropensci' of https://github.com/ropensci-org/buffy into…
mpadge Apr 28, 2021
33132bb
rename team for testing cc @mpadge
maelle Apr 29, 2021
547577f
add goodtoreview command
mpadge Apr 29, 2021
d08631e
rm template form goodtoreview command
mpadge Apr 29, 2021
23d1be9
Merge pull request #12 from mpadge/ropensci
mpadge Apr 29, 2021
6ea949d
revert template_file in goodtoreview response (#13)
mpadge Apr 29, 2021
6c00670
Merge branch 'main' into ropensci
xuanxu May 14, 2021
803ed93
Merge branch 'main' into ropensci
xuanxu May 14, 2021
0fe1f93
update editorcheck external service
mpadge May 19, 2021
e33d1ab
Merge branch 'main' into ropensci
xuanxu May 21, 2021
d00fac2
Merge branch 'main' into ropensci
xuanxu May 24, 2021
c376684
add . to regex
xuanxu May 24, 2021
410edc0
reply with different links depending on submission type
xuanxu May 26, 2021
3e72f5a
refactor responses
xuanxu May 27, 2021
208f2f1
Merge pull request #18 from ropensci-org/reply-by-submission-type
mpadge May 27, 2021
4ee1cf1
Merge branch 'main' into ropensci
xuanxu Jun 2, 2021
639b7a5
Airtable assign reviewer (#21)
xuanxu Jun 29, 2021
fe44620
Merge branch 'main' into ropensci
xuanxu Jul 8, 2021
cac6c7c
Merge branch 'main' into ropensci
xuanxu Jul 8, 2021
3650a88
switch URL for external editorcheck service (#22)
mpadge Jul 23, 2021
d3559c1
Merge branch 'main' into ropensci
xuanxu Jul 26, 2021
eaca8c7
Merge branch 'main' into ropensci
xuanxu Jul 26, 2021
0f0e452
Merge branch 'main' into ropensci
xuanxu Jul 29, 2021
f0c36bd
Merge branch 'main' into ropensci
xuanxu Jul 29, 2021
1a87879
Merge branch 'main' into ropensci
xuanxu Jul 29, 2021
a4f3548
Merge branch 'main' into ropensci
xuanxu Jul 29, 2021
957fdc4
Welcome responder (#29)
mpadge Aug 24, 2021
b1deb34
add name parameter to external service for #23
mpadge Aug 31, 2021
f83771b
Merge pull request #30 from mpadge/ropensci
xuanxu Aug 31, 2021
1736e4d
Merge branch 'main' into ropensci
xuanxu Sep 2, 2021
b74111c
Merge branch 'main' into ropensci
xuanxu Sep 6, 2021
ecf05b8
Merge branch 'main' into ropensci
xuanxu Sep 7, 2021
82dd29b
Approve responder (#27)
xuanxu Sep 10, 2021
e9631d5
Merge branch 'main' into ropensci
xuanxu Oct 21, 2021
bf1137a
Merge branch 'main' into ropensci
xuanxu Oct 21, 2021
10a4c8a
Merge branch 'main' into ropensci
xuanxu Oct 21, 2021
4541b47
User Authenticated API calls (#37)
xuanxu Oct 22, 2021
d944d5e
Merge branch 'main' into ropensci
xuanxu Oct 25, 2021
8a13122
Merge branch 'main' into ropensci
xuanxu Oct 25, 2021
344b45b
Merge branch 'main' into ropensci
xuanxu Oct 25, 2021
87fce37
fix link to issue
xuanxu Oct 25, 2021
6ed2a39
add 'assign' as verb to reviewer responder
mpadge Nov 2, 2021
c09e6b0
Initial values (#43)
maelle Nov 2, 2021
972aabd
Submit reviews responder (#38)
xuanxu Nov 2, 2021
d8964c8
Update settings-production.yml
maelle Nov 2, 2021
68755ea
Merge branch 'ropensci' of https://github.com/ropensci-org/buffy into…
mpadge Nov 2, 2021
c8b5352
Update settings-production.yml
maelle Nov 2, 2021
8621d6b
fix date parsing
xuanxu Nov 2, 2021
9a202e7
fix COC link cc @karthik
maelle Nov 3, 2021
dc5dc37
Merge branch 'main' into ropensci
xuanxu Nov 4, 2021
2d5c695
fix spec
xuanxu Nov 4, 2021
27fff6e
Document token scope needed (#45)
maelle Nov 4, 2021
9ff7074
add 'assign' as verb to reviewer responder
mpadge Nov 2, 2021
935fcc7
add "assign to reviewers" option and fix build
xuanxu Nov 10, 2021
dc227d5
FinalizeTransfer responder (#47)
xuanxu Nov 18, 2021
bf95306
Update settings-production.yml
maelle Nov 18, 2021
d32def2
ISO-8601 dates in Airtable (#49)
xuanxu Nov 26, 2021
70e376f
Merge branch 'main' into ropensci
xuanxu Dec 10, 2021
d27730d
Merge branch 'main' into ropensci
xuanxu Dec 13, 2021
cceeb03
update method name
xuanxu Dec 13, 2021
9227917
Merge branch 'main' into ropensci
xuanxu Dec 20, 2021
b5fff51
Merge branch 'main' into ropensci
xuanxu Dec 20, 2021
0d6b3a6
complete match_data to locals
xuanxu Dec 20, 2021
05fde7d
mode param
xuanxu Dec 20, 2021
56fa997
Merge branch 'main' into ropensci
xuanxu Dec 21, 2021
5deea12
Merge branch 'main' into ropensci
xuanxu Dec 21, 2021
a86460b
Merge branch 'main' into ropensci
xuanxu Dec 23, 2021
0f54d33
Merge branch 'main' into ropensci
xuanxu Jan 3, 2022
e17fd56
fix merge conflict
mpadge Jan 3, 2022
9839ac8
tweak initial_values_responder to be a bit more polite
mpadge Jan 3, 2022
54ecd38
further merge conflict fixes
mpadge Jan 3, 2022
e56b633
update spec with new initial_values_responder phrase
mpadge Jan 3, 2022
b624a11
:wrench:spelling mistake
mpadge Jan 3, 2022
debd04b
another spelling mistake
mpadge Jan 3, 2022
24619fa
Merge branch 'main' into ropensci
xuanxu Jan 4, 2022
4da86b6
Merge branch 'main' into ropensci
xuanxu Jan 13, 2022
99a154d
always invite author when finalizing transfer
xuanxu Jan 13, 2022
647a2c3
Merge branch 'main' into ropensci
xuanxu Jan 17, 2022
d42327d
Merge branch 'main' into ropensci
xuanxu Jan 18, 2022
5bedf7e
fix merge conflict
mpadge Jan 27, 2022
8878afc
Merge branch 'main' into ropensci
xuanxu Feb 9, 2022
a61112d
New responder to set due date (#61)
xuanxu Feb 11, 2022
b0b6d93
Merge branch 'ropensci' of https://github.com/ropensci-org/buffy into…
mpadge Feb 11, 2022
d2bbc7d
Fix repo data for external service; closes #62
mpadge Feb 15, 2022
b3db945
Merge pull request #63 from ropensci-org/external-service-repo
mpadge Feb 16, 2022
c0acd99
Merge branch 'main' into ropensci
xuanxu Feb 23, 2022
ac0ae0b
Merge branch 'main' into ropensci
xuanxu Mar 1, 2022
68cdc26
add default descriptions and example_invocations to ropenci responders
xuanxu Mar 1, 2022
5c5449a
Merge branch 'ropensci' of https://github.com/ropensci-org/buffy into…
mpadge Mar 7, 2022
d688838
rm duplicated external_service config
mpadge Mar 7, 2022
11f738e
revert init_val responders
mpadge Mar 7, 2022
9833846
Merge pull request #65 from mpadge/ropensci
mpadge Mar 7, 2022
f17e873
Merge branch 'main' into ropensci
xuanxu Mar 8, 2022
5d9cf11
Merge branch 'main' into ropensci
xuanxu Mar 8, 2022
14ab099
fix reviewers field name in initial check
xuanxu Mar 8, 2022
9af596b
Merge branch 'main' into ropensci
xuanxu Mar 8, 2022
524546e
Grant access to the check package command to issue authors & reviewer…
xuanxu Mar 10, 2022
1af03a9
Merge branch 'main' into ropensci
xuanxu Mar 18, 2022
bb5bf6b
fix welcome and initial_values responders
mpadge Mar 29, 2022
30f72fc
Merge pull request #68 from mpadge/ropensci
mpadge Mar 29, 2022
aaa1c73
Merge branch 'main' into ropensci
xuanxu Apr 4, 2022
d7b5b98
Allow NA as review time (#70)
xuanxu Apr 7, 2022
48c0f7a
Update settings-production.yml
maelle Apr 7, 2022
1869cfd
Merge branch 'main' into ropensci
xuanxu Apr 18, 2022
49e8849
Configurable deadline reminders (#71)
xuanxu Apr 20, 2022
d05ed49
add pkgcheck_token secret to external_service call for #34, #66
mpadge Apr 26, 2022
91dbf11
add pkgcheck_token secret to external_service call for #34, #66 (#73)
mpadge Apr 26, 2022
3979a18
Merge branch 'main' into ropensci
xuanxu May 4, 2022
30d3cbf
Re-invite author to team (#74)
xuanxu May 26, 2022
624fa36
On hold responder (#75)
xuanxu May 30, 2022
4972d0a
Update settings-development.yml
maelle May 30, 2022
c159e9e
Update settings-production.yml
maelle May 30, 2022
3eca09d
Merge branch 'main' into ropensci
xuanxu Jun 8, 2022
917d68a
Merge branch 'main' into ropensci
xuanxu Jun 22, 2022
b20bd98
Merge branch 'main' into ropensci
xuanxu Jun 22, 2022
e092638
update airrecord
xuanxu Jun 23, 2022
2e1382a
Merge branch 'main' into ropensci
xuanxu Jun 23, 2022
9265999
Highlighting review values in more places (#77)
maelle Jul 7, 2022
e6a0806
Merge branch 'ropensci' of https://github.com/ropensci-org/buffy into…
mpadge Jul 13, 2022
5fdc073
add srrcheck external service; closes #80
mpadge Jul 13, 2022
5f733fe
Merge pull request #81 from ropensci-org/srr
mpadge Jul 14, 2022
85924b0
fix external_service matrix (#82)
mpadge Jul 21, 2022
5e75920
Update settings-production.yml
maelle Jul 21, 2022
dbbc066
Update settings-production.yml
maelle Jul 21, 2022
35298a5
Fix external services config
xuanxu Aug 9, 2022
c3c803f
Merge pull request #83 from ropensci-org/fix-config
mpadge Aug 9, 2022
746dd74
Merge branch 'main' into ropensci
xuanxu Aug 12, 2022
78ff89e
Merge branch 'main' into ropensci
xuanxu Sep 21, 2022
6319fa9
Remove funding file
xuanxu Sep 21, 2022
92393bb
Activate the invite_author command (#87)
xuanxu Sep 22, 2022
eeee3f7
Fix link to reviewer guide (#85)
maelle Sep 22, 2022
43cdd9b
Add packages and authors Airtable entries (#89)
xuanxu Sep 29, 2022
4198792
Merge branch 'main' into ropensci
xuanxu Oct 19, 2022
5a173f8
Bundle install
xuanxu Oct 19, 2022
fd4d531
Merge branch 'main' into ropensci
xuanxu Oct 19, 2022
d44573c
Update SubmitReview responder to add the package (#90)
xuanxu Oct 20, 2022
69d23d3
empty
maelle Nov 7, 2022
acaefa2
Merge branch 'main' into ropensci
xuanxu Dec 1, 2022
6e31fd1
Serialize all data for Sidekiq 7
xuanxu Dec 1, 2022
e62fbb7
Use badge endpoint (#93)
maelle Dec 6, 2022
1ae00cd
Merge branch 'main' into ropensci
xuanxu Dec 12, 2022
bf1282f
Serialize data using json valid types
xuanxu Dec 12, 2022
266b001
Merge branch 'main' into ropensci
xuanxu Dec 12, 2022
956d154
Submit author response (#94)
xuanxu Dec 13, 2022
91fc5f4
check readme only for editors (#95)
maelle Dec 13, 2022
9ddace8
Update settings-production.yml
maelle Dec 13, 2022
4e29d5e
authorize authors to call srrcheck (#96)
mpadge Jan 2, 2023
3174ba2
Merge branch 'main' into ropensci
xuanxu Jan 26, 2023
dd26cbe
Fix spec: Time & Date are serialized now
xuanxu Jan 26, 2023
7d554ed
Merge branch 'main' into ropensci
xuanxu Feb 28, 2023
305058a
Merge branch 'main' into ropensci
xuanxu Apr 12, 2023
1e54688
Update airrecord
xuanxu Apr 12, 2023
8cda374
Remove due-date entry when review is submitted
xuanxu Apr 12, 2023
044d630
Merge branch 'main' into ropensci
xuanxu Apr 12, 2023
6400533
empty
maelle Jan 26, 2023
4958a28
force deploy
maelle Oct 24, 2024
ac0a7f4
Merge branch 'main' into ropensci
xuanxu Oct 24, 2024
efd3765
Update specs
xuanxu Oct 24, 2024
7f2b600
Merge branch 'main' into ropensci
xuanxu Oct 24, 2024
6802751
Bundle with Ruby 3.3.3
xuanxu Oct 24, 2024
e26fb8d
Configure Sidekiq->SSL->Redis
xuanxu Oct 24, 2024
b4df167
Merge pull request #107 from ropensci-org/redis-ssl-config
mpadge Oct 24, 2024
d23afd3
test change
maelle Dec 13, 2024
a978b5e
undo change, test auto deploy
maelle Dec 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/FUNDING.yml

This file was deleted.

13 changes: 13 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ GEM
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
airrecord (1.0.12)
faraday (>= 1.0, < 3.0)
faraday-net_http_persistent
net-http-persistent
base64 (0.2.0)
bibtex-ruby (6.1.0)
latex-decode (~> 0.0)
Expand All @@ -26,6 +30,9 @@ GEM
faraday (>= 2, < 3)
faraday-net_http (3.3.0)
net-http
faraday-net_http_persistent (2.1.0)
faraday (~> 2.5)
net-http-persistent (~> 4.0)
faraday-retry (2.2.1)
faraday (~> 2.0)
github-linguist (8.0.1)
Expand Down Expand Up @@ -53,6 +60,8 @@ GEM
ruby2_keywords (~> 0.0.1)
net-http (0.4.1)
uri
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
nio4r (2.7.3)
nokogiri (1.16.7)
mini_portile2 (~> 2.8.2)
Expand Down Expand Up @@ -132,6 +141,7 @@ PLATFORMS
ruby

DEPENDENCIES
airrecord
bibtex-ruby
chronic
faraday
Expand All @@ -151,5 +161,8 @@ DEPENDENCIES
sinatra-contrib (= 4.0.0)
webmock

RUBY VERSION
ruby 3.3.3p89

BUNDLED WITH
2.5.14
2 changes: 2 additions & 0 deletions Gemfile_custom
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This is a Gemfile to add extra dependencies
# needed for custom responders or workers.
# Override and add customized gems in this file.

gem 'airrecord'
13 changes: 13 additions & 0 deletions app/lib/workers.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
require 'sidekiq'

Sidekiq.configure_server do |config|
config.redis = {
url: ENV["REDIS_URL"],
ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }
}
end
Sidekiq.configure_client do |config|
config.redis = {
url: ENV["REDIS_URL"],
ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }
}
end

require "#{File.expand_path '../..', __FILE__}/workers/buffy_worker.rb"
Dir["#{File.expand_path '../..', __FILE__}/workers/**/*.rb"].sort.each { |f| require f }
60 changes: 60 additions & 0 deletions app/responders/ropensci/approve_responder.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
require_relative '../../lib/responder'

module Ropensci
class ApproveResponder < Responder

keyname :ropensci_approve

def define_listening
@event_action = "issue_comment.created"
@event_regex = /\A@#{bot_name} approve( [ \w-]+)?\.?\s*\z/i
end

def process_message(message)
return unless verify_package_name
return unless verify_submission_type

update_or_add_value("date-accepted", Time.now.strftime("%Y-%m-%d"), append: false, heading: "Date accepted")
respond_external_template(params[:template_file], locals) if params[:template_file]
Ropensci::AirtableWorker.perform_async("clear_assignments", serializable(params), serializable(locals), { "reviewers" => list_of_reviewers })
Ropensci::ApprovedPackageWorker.perform_async("new_team", serializable(params), serializable(locals), { "team_name" => @package_name })
process_labeling
close_issue
end

def verify_package_name
@package_name = match_data[1].to_s.strip
if @package_name.empty?
respond("Could not approve. Please, specify the name of the package.")
return false
end
true
end

def verify_submission_type
submission_type = read_value_from_body("submission-type").downcase
if submission_type == "stats"
statsgrade = read_value_from_body("statsgrade").downcase
if ["bronze", "silver", "gold"].include?(statsgrade)
Ropensci::StatsGradesWorker.perform_async("label", serializable(locals), { "stats_badge_url" => params[:stats_badge_url] })
else
respond("Please add a grade (#{Ropensci::MintResponder::VALID_METAL_VALUES.join("/")}) before approval.")
return false
end
end
true
end

def list_of_reviewers
@list_of_reviewers ||= read_value_from_body("reviewers-list").split(",").map(&:strip)
end

def default_description
"Approves a package. This command will close the issue."
end

def default_example_invocation
"@#{@bot_name} approve package-name"
end
end
end
39 changes: 39 additions & 0 deletions app/responders/ropensci/finalize_transfer_responder.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module Ropensci
class FinalizeTransferResponder < Responder

keyname :ropensci_finalize_transfer

def define_listening
@event_action = "issue_comment.created"
@event_regex = /\A@#{bot_name} (finalize|finalise) transfer of ([\/\w-]+)?\.?\s*\z/i
end

def process_message(message)
return unless verify_package
Ropensci::ApprovedPackageWorker.perform_async("finalize_transfer", serializable(params), serializable(locals), serializable({ package_name: @package_name, package_author: @package_author }))
end

def verify_package
@package_name = match_data[2].to_s.strip
if @package_name.empty?
respond("Could not finalize transfer: Please, specify the name of the package (should match the name of the team at the rOpenSci org)")
return false
end

@package_author = context.issue_author.to_s.strip
if @package_author.empty?
respond("Could not finalize transfer: Could not identify package author")
return false
end
true
end

def default_description
"Adds package's repo to the rOpenSci team. This command should be issued after approval and transfer of the package."
end

def default_example_invocation
"@#{@bot_name} finalize transfer of package-name"
end
end
end
39 changes: 39 additions & 0 deletions app/responders/ropensci/invite_package_author_responder.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
module Ropensci
class InvitePackageAuthorResponder < Responder

keyname :ropensci_invite_author

def define_listening
@event_action = "issue_comment.created"
@event_regex = /\A@#{bot_name} invite me to ([\/\w-]+)?\.?\s*\z/i
end

def process_message(message)
return unless verify_package
Ropensci::ApprovedPackageWorker.perform_async("invite_author_to_transfered_repo", serializable(params), serializable(locals), serializable({ package_name: @package_name, package_author: @package_author }))
end

def verify_package
@package_name = match_data[1].to_s.strip
if @package_name.empty?
respond("Could not invite: Please, specify the name of the team (should match the name of the package at the rOpenSci org)")
return false
end

@package_author = context.issue_author.to_s.strip
if @package_author != context.sender.to_s.strip
respond("Could not invite, you are not the author of the package")
return false
end
true
end

def default_description
"Invite the author of a package to the corresponding rOpenSci team. This command should be issued by the author of the package."
end

def default_example_invocation
"@#{@bot_name} invite me to ropensci/package-name"
end
end
end
46 changes: 46 additions & 0 deletions app/responders/ropensci/mint_responder.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
require_relative '../../lib/responder'

module Ropensci
class MintResponder < Responder

keyname :ropensci_mint

VALID_METAL_VALUES = %w(bronze silver gold)
VALID_SUBMISSION_TYPES = %w(stats)

def define_listening
@event_action = "issue_comment.created"
@event_regex = /\A@#{bot_name} mint( [ \w-]+)?\.?\s*\z/i
end

def process_message(message)
if valid_metal? && valid_submission_type?
update_or_add_value("statsgrade", @metal, append: false, heading: "Badge grade")
respond("Done, #{@metal} minted!")
process_labeling
else
respond(@error_reply)
end
end

def valid_metal?
@error_reply = "Couldn't mint. Please provide a valid value (#{VALID_METAL_VALUES.join('/')})."
@metal = @match_data[1].to_s.strip.downcase
VALID_METAL_VALUES.include?(@metal)
end

def valid_submission_type?
@error_reply = "Only submissions type: #{VALID_SUBMISSION_TYPES.join('/')} can be minted"
submission_type = read_value_from_body("submission-type").downcase
VALID_SUBMISSION_TYPES.include?(submission_type)
end

def default_description
"Mint package as [#{VALID_METAL_VALUES.join("/")}]"
end

def default_example_invocation
"@#{bot_name} mint silver"
end
end
end
43 changes: 43 additions & 0 deletions app/responders/ropensci/on_hold_responder.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
require_relative '../../lib/responder'

module Ropensci
class OnHoldResponder < Responder

keyname :ropensci_on_hold

def define_listening
@event_action = "issue_comment.created"
@event_regex = /\A@#{bot_name} put on hold\.?\s*\z/i
end

def process_message(message)
label_issue([on_hold_label])
Ropensci::OnHoldReminderWorker.perform_at(reminder_at, serializable(locals), {"on_hold_label" => on_hold_label})
respond("Submission on hold!")
end

def on_hold_label
params[:on_hold_label] || "holding"
end

def on_hold_days
if params[:on_hold_days]
params[:on_hold_days].to_i
else
90
end
end

def reminder_at
Time.now + (on_hold_days * 86400)
end

def default_description
"Put the submission on hold for the next #{on_hold_days} days"
end

def default_example_invocation
"@#{bot_name} put on hold"
end
end
end
Loading
Loading