Skip to content

fix(release): mirror built userscripts at repo root for GreasyFork sync - #38

Merged
nsheaps merged 2 commits into
mainfrom
claude/greasyfork-auto-pull-plugins-qhe8nz
Aug 6, 2026
Merged

fix(release): mirror built userscripts at repo root for GreasyFork sync#38
nsheaps merged 2 commits into
mainfrom
claude/greasyfork-auto-pull-plugins-qhe8nz

Conversation

@nsheaps-oura

Copy link
Copy Markdown
Collaborator

Summary

Investigated GreasyFork's actual sync-via-webhook implementation (source: lib/github.rb, app/controllers/concerns/webhooks.rb) to figure out why a sync_identifier pointed at this repo wouldn't actually sync. Findings:

  • For a GitHub release webhook event, GreasyFork only recognizes a sync URL of the form https://github.com/<owner>/<repo>/releases/latest/download/<file> — which is exactly what each package's @downloadURL/@updateURL already uses.
  • To fetch content, it does not download the release asset over HTTP. It resolves that URL back to a git path by stripping the releases/.../download/ prefix and treating whatever's left as the entire repo-relative path (see Github.file_from_root_for_url), then runs git show <release-tag>:<that-path>.
  • That means the path it looks for is the flat filename (<pkg>.user.js), not packages/<pkg>/dist/script.user.js. Our dist-commit only ever contained the nested path, so the webhook's git show would have 404'd on every sync attempt.
  • Push-event-based sync (the other GreasyFork mechanism) can't work for this repo at all, since it requires the file to be reachable from a branch ref, and this pipeline deliberately keeps built dist/ files out of main's history (tag-only).

Changes

  • .github/workflows/release.yaml: the "Commit built userscripts for GreasyFork sync" step now also mirrors each package's built file at the repo root under the flat name matching its release asset (<pkg>.user.js), in addition to the existing nested packages/<pkg>/dist/script.user.js copy. Same dist-commit, same tags (release tag + floating latest).
  • Removed scripts/setup-greasyfork-webhook.js — dead code that POSTed a repository_url/webhook_secret JSON body to /en/users/webhook-info, an endpoint/contract that doesn't exist. GreasyFork's webhook setup is a manual one-time step in its own UI; there is no such automation API.

Test plan

  • Confirmed via GreasyFork's Rails source that the release-event sync path does git show <release-tag>:<file> with <file> derived as a flat, root-relative name for the releases/latest/download/ URL form.
  • Verified the flat filename used here (<pkg-dir-name>.user.js) matches exactly what the existing "Upload userscripts as release assets" step already uploads and what each package's @downloadURL/@updateURL already points at.
  • After merge, confirm a real release run adds root-level github-actions-grafana-jump.user.js, github-to-graphite-button.user.js, and graphite-to-github-button.user.js at the new release tag (git show <tag>:<pkg>.user.js).
  • Once each script's GreasyFork admin page has its sync URL set (manual step, tracked outside this PR), confirm a real GitHub release triggers GreasyFork's webhook and the listing's code actually updates.

Generated by Claude Code

GreasyFork's "release published" webhook only recognizes a sync URL of the
form .../releases/latest/download/<pkg>.user.js by resolving it to a
repo-root-relative git path of exactly <pkg>.user.js at the release's tag -
it does not preserve the packages/<pkg>/dist/ nesting. The dist commit now
also mirrors each built script at repo root under that flat name so
`git show <tag>:<pkg>.user.js` actually finds it.

Also removes scripts/setup-greasyfork-webhook.js, which posted to a
GreasyFork endpoint/contract that doesn't exist (webhook setup is manual via
the GreasyFork UI - there is no such automation API).
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Userscript Version Preview

Preview only — versions and CHANGELOGs are bumped automatically on merge to main, not in this PR. Manual bumps to a higher version are preserved.

Package Base New Action
github-actions-grafana-jump 0.2.2 0.2.3 already-bumped
github-to-graphite-button 0.3.5 0.3.6 already-bumped
graphite-to-github-button 0.3.8 0.3.9 already-bumped

@nsheaps
nsheaps marked this pull request as ready for review August 6, 2026 03:05
…c fix

Manual patch bump on each greasyforkPublish package so merging this PR cuts
a real release - the root-mirror fix itself doesn't touch package source, so
without this the auto-bump pipeline would see no package changes and skip
building/tagging/releasing, leaving the fix unverified end-to-end.
@nsheaps
nsheaps merged commit 06bdc0f into main Aug 6, 2026
5 checks passed
@nsheaps
nsheaps deleted the claude/greasyfork-auto-pull-plugins-qhe8nz branch August 6, 2026 03:09
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.

3 participants