Skip to content

Add GH Action workflow to update downstream repos#73

Open
joverlee521 wants to merge 6 commits intomainfrom
update-vendored
Open

Add GH Action workflow to update downstream repos#73
joverlee521 wants to merge 6 commits intomainfrom
update-vendored

Conversation

@joverlee521
Copy link
Copy Markdown
Contributor

@joverlee521 joverlee521 commented Apr 13, 2026

Description of proposed changes

Searches the Nextstrain GitHub org to find repos that have the .gitrepo file with the nextstrain/shared or nextstrain/ingest remote to create a matrix of repos to potentially update. Installs and uses git subrepo to pull in the latest changes with the --force flag to avoid merge conflicts to due rebasing in the downstream repo. If there are changes pulled down, then git subrepo will create a single commit. If there is a single commit, then push up the changes to a branch and create or update the PR in the downstream repo. Nothing happens if there were no changes and workflow exits with error if it encounters more than one commit.

Related issue(s)

Prompted by nextstrain/public#39 (comment)

Checklist

  • Checks pass
  • If adding a script, add an entry for it in the README.
  • Test run creates/updates PRs in vendored repos
  • latest test run

Comment thread .github/workflows/update-downstream-repos.yaml Outdated
Comment thread .github/workflows/update-vendored.yaml Outdated
Comment thread .github/workflows/update-vendored.yaml Outdated
Comment thread .github/workflows/update-vendored.yaml Outdated
Comment thread .github/workflows/update-vendored.yaml Outdated
@joverlee521 joverlee521 changed the title Add GH Action workflow to update vendored repos Add GH Action workflow to update downstream repos Apr 14, 2026
@joverlee521 joverlee521 force-pushed the update-vendored branch 4 times, most recently from e3df43a to ada3160 Compare April 14, 2026 22:15
@joverlee521

This comment was marked as outdated.

joverlee521 added a commit that referenced this pull request Apr 15, 2026
We should only be keeping a single copy of the vendored repo in each
downstream repo, so deduplicate the matrix by repo. In cases where there
are multiple copies, we are prioritizing the `nextstrain/shared` remote
since that is the newer version.

This is prompted by the error in the workflow when avian-flu had two
paths to update.

<#73 (comment)>
Comment thread .github/workflows/update-downstream-repos.yaml Outdated
Comment thread .github/workflows/update-downstream-repos.yaml Outdated
Comment thread .github/workflows/update-downstream-repos.yaml Outdated
Comment thread .github/workflows/update-downstream-repos.yaml Outdated
Searches the Nextstrain GitHub org to find repos that have the `.gitrepo`
file with the nextstrain/shared remote to create a matrix of repos to
potentially update. Installs and uses `git subrepo` to pull in the latest
changes with the `--force` flag to avoid merge conflicts to due
rebasing in the downstream repo. If there are changes pulled down, then
`git subrepo` will create a single commit. If there is a single commit,
then push up the changes to a branch and create or update the PR in the
downstream repo. Nothing happens if there were no changes and workflow
exits with error if it encounters more than one commit.
I was unable to get the search/code API to work with the 'OR' syntax
so just added a separate query for nextstrain/ingest and concatenated
the two arrays. Deduplicated the final array to guard against potential
overlap.
We should only be keeping a single copy of the vendored repo in each
downstream repo, so deduplicate the matrix by repo. In cases where there
are multiple copies, we are prioritizing the `nextstrain/shared` remote
since that is the newer version.

This is prompted by the error in the workflow when avian-flu had two
paths to update.

<#73 (comment)>
joverlee521 added a commit that referenced this pull request Apr 16, 2026
Prevent the workflow from overwriting additional work on the remote
branch. This allows us to add manual updates directly to the PRs without
having to worry about them being overwritten by the next update run.

Prompted by feedback from @victorlin in review
<#73 (comment)>
joverlee521 added a commit that referenced this pull request Apr 16, 2026
Do not allow `git subrepo` to overwrite local changes in automatic
updates. This will increase failures in the automatic updates but will
flag merge conflicts with local changes in downstream repos for manual
fixes.

Prompted by feedback from @jameshadfield and @victorlin in review
<#73 (comment)>
joverlee521 added a commit that referenced this pull request Apr 16, 2026
Prevent the workflow from overwriting additional work on the remote
branch. This allows us to add manual updates directly to the PRs without
having to worry about them being overwritten by the next update run.

Prompted by feedback from @victorlin in review
<#73 (comment)>
joverlee521 added a commit that referenced this pull request Apr 16, 2026
Do not allow `git subrepo` to overwrite local changes in automatic
updates. This will increase failures in the automatic updates but will
flag merge conflicts with local changes in downstream repos for manual
fixes.

Prompted by feedback from @jameshadfield and @victorlin in review
<#73 (comment)>
joverlee521 added a commit that referenced this pull request Apr 16, 2026
Do not allow `git subrepo` to overwrite local changes in automatic
updates. This will increase failures in the automatic updates but will
flag merge conflicts with local changes in downstream repos for manual
fixes.

Note this requires us to fetch all git history for the downstream repos
since `git subrepo pull` now needs to validate the parent commit.

Prompted by feedback from @jameshadfield and @victorlin in review
<#73 (comment)>
Do not allow `git subrepo` to overwrite local changes in automatic
updates. This will increase failures in the automatic updates but will
flag merge conflicts with local changes in downstream repos for manual
fixes.

Note this requires us to fetch all git history for the downstream repos
since `git subrepo pull` now needs to validate the parent commit.

Prompted by feedback from @jameshadfield and @victorlin in review
<#73 (comment)>
Try to fetch remote branch and add subrepo changes to prevent automatic
updates from overwriting manual updates. This also allows us to skip
unnecessary pushes to the PR if the remote branch is already up-to-date.
@joverlee521
Copy link
Copy Markdown
Contributor Author

If there's no other feedback, I'll merge this Monday.

The merge of this PR should automatically trigger a workflow run to update downstream repos. Since this is a new change, the existing PRs in downstream repos should get updated. Then I'll go through those PRs to fix and merge them, which should finally allow us to get back to nextstrain/public#39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants