Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Check paginated versions during Rollback version check (#1629)

sarayourfriendb0f33ccb7240
diff --git a/.github/workflows/rollback.yml b/.github/workflows/rollback.yml
index 734aeb95a..e69c1c7e5 100644
--- a/.github/workflows/rollback.yml
+++ b/.github/workflows/rollback.yml
@@ -41,16 +41,32 @@ jobs:
uses: actions/github-script@v6
with:
script: |
- const { data: versions } = await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({
- package_type: 'container',
- package_name: 'openverse-frontend',
- org: 'WordPress',
- })
+ let exists = undefined,
+ page = 0
+
+ while (!exists) {
+ page += 1
+ const { data: versions } =
+ await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({
+ package_type: 'container',
+ package_name: 'openverse-frontend',
+ org: 'WordPress',
+ page,
+ // max of `per_page`
+ per_page: 100,
+ })
+
+ if (!versions.length) {
+ break
+ }
- const exists = versions.some(v => v.metadata.container.tags.includes("${{ inputs.tag }}"))
+ exists = versions.some((v) => v.metadata.container.tags.includes('${{ inputs.tag }}'))
+ }
if (!exists) {
- throw new Error("`${{ inputs.tag }}` does not appear to be a valid tag for the ghcr.io/wordpress/openverse-frontend image.")
+ throw new Error(
+ '`${{ inputs.tag }}` does not appear to be a valid tag for the ghcr.io/wordpress/openverse-frontend image.'
+ )
}
- uses: ./.github/actions/production-frontend-deploy