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

Restore nextstrain.org PRs #1565

Merged
merged 5 commits into from
Oct 10, 2022
Merged

Conversation

victorlin
Copy link
Member

@victorlin victorlin commented Oct 4, 2022

Description of proposed changes

Follow-up to db85805.

Heroku is building review apps for nextstrain.org now.

Related issue(s)

Testing

  • Manual trigger using gh workflow run "Make PRs for Nextstrain projects which depend on Auspice" --repo nextstrain/auspice --ref victorlin/restore-nextstrain.org-prs succeeds (link)
  • The resulting PR looks good, and a new PR doesn't get created upon updates
  • Figure out why runs are taking so long (>15m) not worth it

@victorlin victorlin requested a review from a team October 4, 2022 23:07
@victorlin victorlin self-assigned this Oct 4, 2022
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 4, 2022 23:07 Inactive
@victorlin victorlin mentioned this pull request Oct 4, 2022
6 tasks
@tsibley
Copy link
Member

tsibley commented Oct 4, 2022

Heroku is still not building review apps

Uh, yes they are? Maybe we forgot to re-enable them for Auspice, but they work for nextstrain.org. [Edit: Ah, this is for review apps for nextstrain.org PRs not (directly) Auspice PRs, so now I'm really confused why it appears to not be working.]

Copy link
Member

@tsibley tsibley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for the re-enabling here.

Not the fault of this PR, but I'm still not thrilled that we're passing decently powerful credentials to some random third-party code:

uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.NEXTSTRAIN_BOT_PAT }}

@jameshadfield
Copy link
Member

Good timing! As per #1564 I'd recommend making this a workflow dispatch rather than automatically making a (nextstrain.org) PR for each auspice PR -- in practice this resulted in too many unnecessary PRs which became confusing.

Follow-up to db85805.

Heroku is building review apps for nextstrain.org now.
@victorlin victorlin force-pushed the victorlin/restore-nextstrain.org-prs branch from 5ba0b26 to 83b46b8 Compare October 5, 2022 16:48
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 5, 2022 16:49 Inactive
@victorlin
Copy link
Member Author

@tsibley oh you're right, they are working on nextstrain.org PRs. I updated the commit/PR descriptions to reflect that.

@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 5, 2022 17:05 Inactive
@victorlin victorlin force-pushed the victorlin/restore-nextstrain.org-prs branch from 8516b2b to af56b03 Compare October 5, 2022 17:28
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 5, 2022 17:29 Inactive
@victorlin victorlin marked this pull request as draft October 5, 2022 18:05
@tsibley
Copy link
Member

tsibley commented Oct 5, 2022

@victorlin

From the message of af56b03:

Two notes:

1. The title and description of the PR have been updated to use the
   source ref (e.g. branch, tag) rather than PR number, since that is
   not guaranteed or retrievable with the manual trigger.
2. The commit to install Auspice from is changing from the
   GitHub-managed PR merge HEAD to the source ref HEAD. This can have
   implications when run on a PR's source branch if there are notable
   changes in the target branch unincorporated in the source branch. To
   mitigate this, make sure to update the source branch (e.g. with a git
   rebase) before triggering this workflow.

To avoid both of these issues, can we instead make the workflow accept a PR number? e.g.:

gh workflow run "Make PRs for Nextstrain projects which depend on Auspice" \
  --repo nextstrain/auspice \
  -f pr=1565

The workflow would then have the PR number to use and be able to turn refs/pull/${{inputs.pr}}/merge into a commit id (SHA) and use that as it previously did.

Having "directories" for automatically created branches can help make
the branch list more navigable for some users.
@victorlin victorlin force-pushed the victorlin/restore-nextstrain.org-prs branch from af56b03 to 243046d Compare October 5, 2022 21:16
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 5, 2022 21:17 Inactive
@victorlin victorlin force-pushed the victorlin/restore-nextstrain.org-prs branch from 243046d to 9c9bfd3 Compare October 5, 2022 22:00
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 5, 2022 22:00 Inactive
@victorlin
Copy link
Member Author

@tsibley I've opted for automatic retrieval of PR number using gh pr view: 9c9bfd3 Still WIP but the PR number retrieval should work. Good point about using refs/pull/${{inputs.pr}}/merge, I'll add that back.

@jameshadfield
Copy link
Member

jameshadfield commented Oct 5, 2022

@victorlin is your intention to run these on the head commit of the branch (which is what I did when I set up the action) or the merge commit of the branch into master (which is GITHUB_SHA, as I understand it)? I don't know which is the best for this purpose, but I thought it'd be difficult to try to debug a failing nextstrain.org build if the problem was only introduced by the merge and thus didn't exist on the auspice PR branch.

@victorlin
Copy link
Member Author

@jameshadfield oops, I got your original intention backwards in my commit message. You're right, GITHUB_SHA for pull_request events reflect the GitHub-managed PR merge and your implementation.

In the currently pushed implementation, I intend to run these on the head commit of the branch (not merge), which is simply GITHUB_SHA for the workflow_dispatch event. So this would be the same as before.

However, @tsibley noted from my (incorrect) commit description that it's still possible to get the merge ref from the PR number. This would change behavior as you mention:

I thought it'd be difficult to try to debug a failing nextstrain.org build if the problem was only introduced by the merge and thus didn't exist on the auspice PR branch.

I'd actually be in favor of surfacing these failures, since they are bound to come up once actually merged, and better to catch them sooner than later.

@jameshadfield
Copy link
Member

I'd actually be in favor of surfacing these failures, since they are bound to come up once actually merged, and better to catch them sooner than later.

Fair enough. Perhaps add a message to this effect in the PR body, as this will catch someone out!

the head commit of the branch (not merge), which is simply GITHUB_SHA for the workflow_dispatch event

I guess this makes some sense, but I find it super confusing to have GITHUB_SHA refer to different things depending on the trigger. I didn't actually know a branch-merge-commit (which isn't found anywhere in your local git tree) even exists until I wrote the original action here.

@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 5, 2022 23:10 Inactive
@victorlin victorlin force-pushed the victorlin/restore-nextstrain.org-prs branch from 6e64179 to 18199bc Compare October 5, 2022 23:13
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 5, 2022 23:13 Inactive
@victorlin victorlin force-pushed the victorlin/restore-nextstrain.org-prs branch from 18199bc to 27b49a7 Compare October 5, 2022 23:28
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 5, 2022 23:28 Inactive
@victorlin victorlin force-pushed the victorlin/restore-nextstrain.org-prs branch from 27b49a7 to 95d921b Compare October 5, 2022 23:58
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 5, 2022 23:59 Inactive
@victorlin
Copy link
Member Author

Updated to only allow branches with PRs, for simplicity and parity with previous behavior.

This allows us to only create review PRs in the downstream repo when
necessary, reducing the amount of excessive automated PRs.

Two notes:

1. With the manual trigger, there is an option to allow this workflow to
   run on tags and branches without PRs. To keep the logic simpler and
   maintain previous behavior, I've chosen to not allow those scenarios.
2. The GITHUB_SHA of workflow_dispatch is no longer the GitHub-managed
   PR merge ref, so it can be used here to retain original behavior.

Also, do all the nextstrain.org work under a separate directory
DESTINATION_REPO_DIR to make steps a bit more distinct.
@victorlin victorlin force-pushed the victorlin/restore-nextstrain.org-prs branch from 95d921b to 328ae93 Compare October 6, 2022 18:25
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 6, 2022 18:26 Inactive
@victorlin victorlin force-pushed the victorlin/restore-nextstrain.org-prs branch from 328ae93 to d5637ee Compare October 6, 2022 22:23
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 6, 2022 22:23 Inactive
@victorlin
Copy link
Member Author

This is ready for review again. I went down a deep rabbit hole on the last task in the PR tasklist - figuring out why runs are taking so long [1] [2], and trying alternatives unsuccessfully. 15 minute npm installs aren't ideal, but I think we can live with it.

@victorlin victorlin marked this pull request as ready for review October 6, 2022 22:31
@victorlin victorlin requested a review from a team October 6, 2022 22:32
Copy link
Member

@jameshadfield jameshadfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good @victorlin -- thanks for persevering 😄

@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 10, 2022 17:20 Inactive
Previously, Auspice was installed from the source branch HEAD directly.
This can fail to catch issues if there are notable changes in the PR
target branch unincorporated in the source branch. Creating the
nextstrain.org PR from the auto-merged ref should surface any
merge-related issues sooner than later.
@victorlin victorlin force-pushed the victorlin/restore-nextstrain.org-prs branch from 39fea44 to bca8971 Compare October 10, 2022 17:21
@nextstrain-bot nextstrain-bot temporarily deployed to auspice-victorlin-resto-bhiizj October 10, 2022 17:21 Inactive
@victorlin victorlin merged commit a6f6e5b into master Oct 10, 2022
@victorlin victorlin deleted the victorlin/restore-nextstrain.org-prs branch October 10, 2022 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

reenable nextstrain.org PR action
4 participants