Skip to content

feat: read from GitHub using the github module#25

Merged
eddie-knight merged 1 commit intoossf:mainfrom
trumant:read-using-github-client
May 6, 2025
Merged

feat: read from GitHub using the github module#25
eddie-knight merged 1 commit intoossf:mainfrom
trumant:read-using-github-client

Conversation

@trumant
Copy link
Copy Markdown
Contributor

@trumant trumant commented May 4, 2025

This PR builds on the changes in #24 to:

  1. Use the GitHub go module client to fetch Insights data from GitHub, vs the previous custom implementation
  2. Introduce a new Load func, making this module more useful to clients who have an Insights file on hand
  3. Add test coverage of these changes

I wouldn't expect to merge this without first merging the #24 and rebasing this against main.

@trumant trumant force-pushed the read-using-github-client branch from 604ac66 to 68a40fb Compare May 6, 2025 20:14
Comment thread v2/si/import.go
"github.com/goccy/go-yaml"
)

type FileAPIResponse struct {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This duplicates a type defined by go-github, so we can just theirs

Comment thread v2/si/import.go Outdated
Funding string `yaml:"funding"`
Administrators []Contact `yaml:"administrators"`
Repositories []Repo `yaml:"repositories"`
Steward *Link `yaml:"steward"`
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately when ossf/security-insights@4c4a631 merged, a strict YAML parse/decode (i.e. one with reject unknown fields enabled) would fail when attempting to decode any insights file like https://github.com/ossf/security-insights-spec/blob/main/.github/security-insights.yml that had a project.steward defined.

@trumant trumant force-pushed the read-using-github-client branch from 68a40fb to bfb2c61 Compare May 6, 2025 20:26
url: https://vcs.example.com/foobar/foo
comment: |
Foo is the core repo for FooBar.
steward:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Note that steward is here as well

This change updates Read to use the github/v71
module client. This change also adds a Load
func for those clients who have an SI data file
at hand. Finally, test coverage is added.

Signed-off-by: Travis Truman <trumant@gmail.com>
@trumant trumant force-pushed the read-using-github-client branch from bfb2c61 to ad440b2 Compare May 6, 2025 20:28
Copy link
Copy Markdown
Contributor

@eddie-knight eddie-knight left a comment

Choose a reason for hiding this comment

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

Tested this using pvtr-github-repo locally against multiple targets without any unexpected behavior or changes required in that codebase 👍

@eddie-knight eddie-knight merged commit c7c2980 into ossf:main May 6, 2025
1 check passed
@trumant trumant deleted the read-using-github-client branch May 6, 2025 20:46
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.

2 participants