Validate repository org-ownership before storage record creation#328
Merged
malancas merged 14 commits intoJan 26, 2026
Merged
Conversation
…ord creation Signed-off-by: Meredith Lancaster <[email protected]>
Signed-off-by: Meredith Lancaster <[email protected]>
Signed-off-by: Meredith Lancaster <[email protected]>
Signed-off-by: Meredith Lancaster <[email protected]>
Signed-off-by: Meredith Lancaster <[email protected]>
Signed-off-by: Meredith Lancaster <[email protected]>
Signed-off-by: Meredith Lancaster <[email protected]>
Signed-off-by: Meredith Lancaster <[email protected]>
Signed-off-by: Meredith Lancaster <[email protected]>
Signed-off-by: Meredith Lancaster <[email protected]>
Signed-off-by: Meredith Lancaster <[email protected]>
Signed-off-by: Meredith Lancaster <[email protected]>
Signed-off-by: Meredith Lancaster <[email protected]>
Contributor
There was a problem hiding this comment.
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
repoOwnerIsOrghelper 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.
ajbeattie
approved these changes
Jan 21, 2026
bdehamer
reviewed
Jan 21, 2026
bdehamer
approved these changes
Jan 26, 2026
malancas
deleted the
malancas/validate-org-repo-owner-before-storage-record
branch
January 26, 2026 16:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 nestedowner.typefield, which must be either "User" or "Organization".