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

Commit 407f4e2

Browse files
authored
Merge pull request #139 from openjournals/label-on-success
Add acceptance labels after PR with the compiled paper is created
2 parents a96ceb9 + 6ad116f commit 407f4e2

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
@@ -337,12 +337,10 @@ def deposit(dry_run, custom_branch=nil)
337337
end
338338

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

workers.rb

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

586586
if dry_run == true
587587
pr_url = create_deposit_pr(issue_id, config.papers_repo, config.journal_alias, dry_run)
588+
labels = ['recommend-accept']
588589

589590
if custom_branch
590591
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```"
@@ -601,13 +602,15 @@ def perform(nwo, issue_id, config, custom_branch, dry_run)
601602
doi = "https://doi.org/#{config.doi_prefix}/#{config.journal_alias}.#{id}"
602603

603604
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..."
605+
labels = ['accepted', 'published']
604606

605607
# Only Tweet if configured with keys
606608
if config.twitter_consumer_key
607609
whedon_tweet(crossref_xml_path, nwo, issue_id, config)
608610
end
609611
end
610-
# Finally, respond in the review issue with the PDF URL
612+
# Finally, add labels and respond in the review issue with the PDF URL
613+
label_issue(@nwo, @issue_id, labels)
611614
bg_respond(nwo, issue_id, pr_response)
612615
# Clean-up
613616
FileUtils.rm_rf("#{jid}") if Dir.exist?("#{jid}")

0 commit comments

Comments
 (0)