playfulprogramming / playfulprogramming/hoof
Implement WEBHOOK_PUSH/PULL_REQUEST jobs
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 9
- Forks
- 7
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 23
Description
When a push or pull request payload is received, we need to determine the diff from the last sync, or from the current main branch.
This can be done with the /repos/{owner}/{repo}/compare/{basehead} API: https://docs.github.com/en/rest/commits/commits?apiVersion=2026-03-10#compare-two-commits
For push payloads...
Verify that the branch is main (if not, log & return). Use the before and after sha properties as the base/head of the comparison.
For pull_request payloads...
We will need a new table to record previous pull_request imports. This should track the branch name (indexed & unique) and the commit sha, with a uuid PK.
When a new event is received, find the last processed commit sha from the database, and use that as the base for the comparison. Otherwise, use the base.sha from the pull request payload.
After fetching the comparison (in both jobs):
Iterate through files[] and collect file paths that match any post, collection, or author contents. (note that posts and post subdirs are both counted, whereas authors/collections only count files directly within their folders)
content/{user}/*-> authorcontent/{user}/posts/{post}/**-> postcontent/{user}/collections/{collection}/*-> collectioncontent/{user}/collections/{collection}/posts/{post}/**-> post
Then, for each discovered ID, trigger and await the response of the sync-author, sync-collection, and sync-post jobs.
These jobs can be parallelized, but the logic must consider dependencies - if both a collection and a post within the collection need to be synced, the collection must finish syncing before the post. Likewise for authors -> collections, or authors -> posts.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the WEBHOOK_PUSH and WEBHOOK_PULL_REQUEST handlers, the sync-author, sync-collection, and sync-post jobs, and the existing database models. Read how webhook payloads and job dependencies are handled, then use GitHub's compare API as specified. Done means both events classify changed content, persist pull-request state, trigger dependent syncs in order, and ignore non-main pushes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, typescript
- Domain
- api, backend, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100