Skip to content
This repository was archived by the owner on Apr 9, 2024. It is now read-only.

Commit 6ad116f

Browse files
committed
move acceptance labeling to DepositWorker
1 parent 2fc5710 commit 6ad116f

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

spec/whedon_api_spec.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
expect(DepositWorker).to receive(:perform_async).once
272272
allow(Octokit::Client).to receive(:new).once.and_return(github_client)
273273
expect(github_client).to receive(:add_comment).once.with(anything, anything, /Attempting dry run of processing paper acceptance/)
274-
expect(github_client).to receive(:label_issue).never
274+
expect(github_client).to receive(:add_labels_to_an_issue).never
275275
post '/dispatch', whedon_accept_with_doi, {'CONTENT_TYPE' => 'application/json'}
276276
end
277277

@@ -285,6 +285,7 @@
285285
expect(DepositWorker).to receive(:perform_async).once
286286
allow(Octokit::Client).to receive(:new).once.and_return(github_client)
287287
expect(github_client).to receive(:add_comment).once.with(anything, anything, /Doing it live! Attempting automated processing of paper acceptance.../)
288+
expect(github_client).to receive(:add_labels_to_an_issue).never
288289
post '/dispatch', whedon_accept_for_reals_with_doi, {'CONTENT_TYPE' => 'application/json'}
289290
end
290291

whedon_api.rb

-2
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,10 @@ def deposit(dry_run, custom_branch=nil)
336336
end
337337

338338
if dry_run == true
339-
label_issue(@nwo, @issue_id, ['recommend-accept'])
340339
respond "```\nAttempting dry run of processing paper acceptance...\n```"
341340
DOIWorker.perform_async(@nwo, @issue_id, serialized_config, custom_branch)
342341
DepositWorker.perform_async(@nwo, @issue_id, serialized_config, custom_branch, dry_run=true)
343342
else
344-
label_issue(@nwo, @issue_id, ['accepted', 'published'])
345343
respond "```\nDoing it live! Attempting automated processing of paper acceptance...\n```"
346344
DepositWorker.perform_async(@nwo, @issue_id, serialized_config, custom_branch, dry_run=false)
347345
end

workers.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ def perform(nwo, issue_id, config, custom_branch, dry_run)
544544

545545
if dry_run == true
546546
pr_url = create_deposit_pr(issue_id, config.papers_repo, config.journal_alias, dry_run)
547+
labels = ['recommend-accept']
547548

548549
if custom_branch
549550
pr_response = ":wave: @#{config.eic_team_name}, this paper is ready to be accepted and published.\n\n Check final proof :point_right: #{pr_url}\n\nIf the paper PDF and Crossref deposit XML look good in #{pr_url}, then you can now move forward with accepting the submission by compiling again with the flag `deposit=true` e.g.\n ```\n@whedon accept deposit=true from branch #{custom_branch} \n```"
@@ -560,13 +561,15 @@ def perform(nwo, issue_id, config, custom_branch, dry_run)
560561
doi = "https://doi.org/#{config.doi_prefix}/#{config.journal_alias}.#{id}"
561562

562563
pr_response = "🚨🚨🚨 **THIS IS NOT A DRILL, YOU HAVE JUST ACCEPTED A PAPER INTO #{config.journal_alias.upcase}!** 🚨🚨🚨\n\n Here's what you must now do:\n\n0. Check final PDF and Crossref metadata that was deposited :point_right: #{pr_url}\n1. Wait a couple of minutes, then verify that the paper DOI resolves [#{doi}](#{doi})\n2. If everything looks good, then close this review issue.\n3. Party like you just published a paper! 🎉🌈🦄💃👻🤘\n\n Any issues? Notify your editorial technical team..."
564+
labels = ['accepted', 'published']
563565

564566
# Only Tweet if configured with keys
565567
if config.twitter_consumer_key
566568
whedon_tweet(crossref_xml_path, nwo, issue_id, config)
567569
end
568570
end
569-
# Finally, respond in the review issue with the PDF URL
571+
# Finally, add labels and respond in the review issue with the PDF URL
572+
label_issue(@nwo, @issue_id, labels)
570573
bg_respond(nwo, issue_id, pr_response)
571574
# Clean-up
572575
FileUtils.rm_rf("#{jid}") if Dir.exist?("#{jid}")

0 commit comments

Comments
 (0)