Add Spring Boot GitHub helper library for PAT storage and commit/PR resolution#1
Conversation
|
@copilot to avoid scope issues with the table, let's prefix the table names with Otherwise, they may conflict with table names that are already in the applications. Also: we will need to think about how liquibase database migrations work when adopting this library. Do we need to add instructions to copy a particular database migration into the proper place? Or is there a way for libraries like this to manage their own tables with some kind of "hook" into liquibase? What is best practice for this situation? |
Addressed in |
This introduces
lib-github-helperas a Spring Boot dependency that can store an encrypted GitHub fine-grained PAT and expose GitHub metadata endpoints for recentmaincommits, open PR commits, and SHA-to-branch/PR resolution. The library is designed to support deployed-commit inspection flows, including mapping a SHA to expressions likemain~3orfeature-branch~2.Spring Boot starter structure
edu.ucsb.cs156.githubhelperwith controller, services, repository, and models.Encrypted PAT storage
github_patstable andGithubPatentity for persisted PATs plus optional expiration.PatEncryptionServiceandGithubPatServiceto encrypt at rest and retrieve the latest non-expired token.POST /api/githubhelper/patfor uploading a token and optional expiration timestamp.GitHub helper endpoints
GET /api/githubhelper/prs/{owner}/{repo}to return:GET /api/githubhelper/commit/{owner}/{repo}/{sha}to classify a SHA as:mainmain~Nbranch~NResponse model for frontend integration
Documentation
lib-jobsExample response shape for commit lookup:
{ "owner": "ucsb-cs156", "repo": "lib-github-helper", "sha": "012def", "matched": true, "matches": [ { "kind": "pull_request", "branchName": "feature-branch", "expression": "feature-branch~1", "distance": 1, "url": "https://github.com/ucsb-cs156/lib-github-helper/pull/12", "pullRequestNumber": 12, "pullRequestTitle": "Add feature" } ] }Original prompt