Skip to content

Conversation

@malancas
Copy link
Contributor

@malancas malancas commented Jan 16, 2026

Validate that a repository is owned by an organization before attempting to create a storage record. Storage records can only be created on behalf of artifacts generated in repositories owned by organizations. The feature is not supported for repositories owned by users.

There does not seem to be a reliable way of fetching the repository owner type from the GitHub context provided in the @actions/github. We can reliable check whether a repository is owned by an organization or user with the get repository endpoint. The response must return the nested owner.type field, which must be either "User" or "Organization".

malancas and others added 14 commits January 16, 2026 05:19
…ord creation

Signed-off-by: Meredith Lancaster <malancas@github.com>
Signed-off-by: Meredith Lancaster <malancas@github.com>
Signed-off-by: Meredith Lancaster <malancas@github.com>
Signed-off-by: Meredith Lancaster <malancas@github.com>
Signed-off-by: Meredith Lancaster <malancas@github.com>
Signed-off-by: Meredith Lancaster <malancas@github.com>
Signed-off-by: Meredith Lancaster <malancas@github.com>
Signed-off-by: Meredith Lancaster <malancas@github.com>
Signed-off-by: Meredith Lancaster <malancas@github.com>
Signed-off-by: Meredith Lancaster <malancas@github.com>
Signed-off-by: Meredith Lancaster <malancas@github.com>
Signed-off-by: Meredith Lancaster <malancas@github.com>
Signed-off-by: Meredith Lancaster <malancas@github.com>
@malancas malancas marked this pull request as ready for review January 21, 2026 12:34
@malancas malancas requested a review from a team as a code owner January 21, 2026 12:34
Copilot AI review requested due to automatic review settings January 21, 2026 12:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds validation to ensure that storage records are only created for repositories owned by organizations, not individual users. The storage record feature is organization-only, so this validation prevents unnecessary API calls and potential errors when running in user-owned repositories.

Changes:

  • Added a repoOwnerIsOrg helper function that uses the GitHub REST API to check repository ownership type
  • Modified attestation flow to skip storage record creation for user-owned repositories
  • Added comprehensive test coverage for the new validation logic

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/attest.ts Implements organization ownership check before storage record creation and adds repoOwnerIsOrg helper function
tests/main.test.ts Adds test coverage for the new organization check and verifies storage records aren't created for user-owned repos

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@malancas malancas merged commit 20eb46c into main Jan 26, 2026
5 checks passed
@malancas malancas deleted the malancas/validate-org-repo-owner-before-storage-record branch January 26, 2026 16:31
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.

4 participants