Skip to content

Check owner IDs of added and changed collection index entries - #760

Merged
Abdurrahmaan Iqbal (abdurriq) merged 3 commits into
gh-pagesfrom
chrmarti/keen-badger
Nov 23, 2026
Merged

Abdurrahmaan Iqbal (abdurriq) merged 3 commits into
gh-pagesfrom
chrmarti/keen-badger

Conversation

@chrmarti

@chrmarti Christof Marti (chrmarti) commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a job to the collection-index.yml lint workflow that checks the entries a pull request adds or changes. Each entry must have name, maintainer, contact, repository and ociReference. A ghcr.io collection must also have a numeric ownerId that matches the GitHub account named in its ociReference. A wrong or missing ownerId is caught during review instead of the collection being skipped silently at the next crawl.

Session Context

Key decisions from the development session:

  • Why: Remove entries of renamed or deleted accounts and add owner IDs #755 added ownerId to every ghcr.io entry, and the crawler now skips collections whose ownerId is missing or doesn't match the account that currently holds the owner name (protecting against reused names of renamed or deleted accounts). Nothing checked the field on submission.
  • Only added and changed entries: The job compares the parsed entries with the base branch (yq to JSON, then jq array difference), so it makes a handful of API calls per PR and doesn't fail unrelated PRs when an existing collection's owner changes. The daily crawl still checks every entry.
  • Required keys: Also checked for changed entries, because a misspelled ociReference (like the existing ocireference and ociReferences entries) would otherwise bypass the ownerId check. The four existing broken entries aren't touched, so they don't fail this PR or others.
  • Matches the crawler: The registry prefix is matched case-insensitively and the owner is the second path segment of ociReference, as in the crawler. A 403 with the Actions token is retried once without it, because organizations with an IP allow list (e.g. wandb) reject the token even for public profile data. Other lookup failures fail the job.
  • Owner validation: The owner name must match ^[A-Za-z0-9-]+$ before it's used in the API URL.
  • Script file instead of inline: .github/scripts/check-collection-index.sh, so it can be run and tested locally. The workflow and script paths were added to the trigger so changes to the check run it.
  • Plain shell: Uses yq, jq and curl, which are preinstalled on ubuntu-latest, so there's nothing to install.
  • Tested locally: No changes, the restored prplecake entry (Restore prplecake entry #759), and all 318 ownerIds from Remove entries of renamed or deleted accounts and add owner IDs #755 (compared with the commit before it) pass. Crafted entries with a reused name, missing, string-typed or wrong ownerId, unknown account, misspelled ociReference, mixed-case GHCR.IO, and an invalid owner segment each produce an error annotation. A different registry needs no ownerId. Works with and without a token; a failed lookup fails the job. shellcheck and actionlint pass.
  • Tested in CI: A temporary commit (reverted in this PR) changed the wandb entry and added an entry with a reused owner name. The job checked both, rejected the reused name, and accepted wandb, so the unauthenticated retry for IP allow lists works with the Actions token.

Changes

  • .github/scripts/check-collection-index.sh: new check script.
  • .github/workflows/lint.yml: new Check added and changed entries job; trigger paths include the workflow and script.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the collection-index validation changes.

No open issues 🎉

What changed in this PR

Adds pull-request validation for collection index entries, complementing the crawler’s owner-ID checks so invalid submissions are caught before merging.

Changes:

  • Compares the index with the base branch to check only added or changed entries.
  • Validates required fields and verifies numeric ownerId values for ghcr.io collections against GitHub account IDs, retrying unauthenticated after a 403 response.
  • Adds a lint job and triggers it when the index, validation script, or workflow changes.
File Description
.github/​workflows/​lint.yml Adds the entry-validation job and expands trigger paths.
.github/​scripts/​check-collection-index.sh Checks changed entries for required fields and matching GitHub owner IDs.

Review effort: Balanced

@chrmarti
Christof Marti (chrmarti) marked this pull request as ready for review November 23, 2026 09:19
@chrmarti
Christof Marti (chrmarti) requested a review from a team as a code owner November 23, 2026 09:19
@abdurriq
Abdurrahmaan Iqbal (abdurriq) merged commit 103de6f into gh-pages Nov 23, 2026
9 checks passed
@abdurriq
Abdurrahmaan Iqbal (abdurriq) deleted the chrmarti/keen-badger branch November 23, 2026 13:32
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