playfulprogramming / playfulprogramming/hoof

Implement WEBHOOK_PUSH/PULL_REQUEST jobs

Open
#206 0 comments 0 reactions 0 assignees View on GitHub

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}/* -> author
  • content/{user}/posts/{post}/** -> post
  • content/{user}/collections/{collection}/* -> collection
  • content/{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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.