Discussions » Greasy Fork Feedback
The Webhook Update suddenly does not work
I can use manual sync in Admin tab to do the update. (although the changelog messsage is lost)
I changed the source link now it is back to normal.
I guess this is because the login requirement in github.com ?
Jason, could you please take a look?
I faced such issue once before.
Login required: (sometimes?)
Login NOT required:
I haven't changed anything here recently. I'll have to investigate.
Can you post the request data for the one that failed?
Some sensitive info are replaced to ******
{
"ref": "refs/heads/main",
"before": "8b6620b0e8f33dd3e98dcef31fe5ff8ddbb41be5",
"after": "1c59bf41be5d4d41b1900dc11c8cbf9aa680c243",
"repository": {
"id": 576617012,
"node_id": "******",
"name": "userscript-supports",
"full_name": "cyfung1031/userscript-supports",
"private": false,
"owner": {
"name": "cyfung1031",
"email": "******",
"login": "cyfung1031",
"id": 44498510,
"node_id": "******",
"avatar_url": "https://avatars.githubusercontent.com/u/44498510?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/cyfung1031",
"html_url": "https://github.com/cyfung1031",
"followers_url": "https://api.github.com/users/cyfung1031/followers",
"following_url": "https://api.github.com/users/cyfung1031/following{/other_user}",
"gists_url": "https://api.github.com/users/cyfung1031/gists{/gist_id}",
"starred_url": "https://api.github.com/users/cyfung1031/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/cyfung1031/subscriptions",
"organizations_url": "https://api.github.com/users/cyfung1031/orgs",
"repos_url": "https://api.github.com/users/cyfung1031/repos",
"events_url": "https://api.github.com/users/cyfung1031/events{/privacy}",
"received_events_url": "https://api.github.com/users/cyfung1031/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
},
"html_url": "https://github.com/cyfung1031/userscript-supports",
"description": "This is for the userscripts created on GreasyFork.org. ",
"fork": false,
"url": "https://api.github.com/repos/cyfung1031/userscript-supports",
"forks_url": "https://api.github.com/repos/cyfung1031/userscript-supports/forks",
"keys_url": "https://api.github.com/repos/cyfung1031/userscript-supports/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/cyfung1031/userscript-supports/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/cyfung1031/userscript-supports/teams",
"hooks_url": "https://api.github.com/repos/cyfung1031/userscript-supports/hooks",
"issue_events_url": "https://api.github.com/repos/cyfung1031/userscript-supports/issues/events{/number}",
"events_url": "https://api.github.com/repos/cyfung1031/userscript-supports/events",
"assignees_url": "https://api.github.com/repos/cyfung1031/userscript-supports/assignees{/user}",
"branches_url": "https://api.github.com/repos/cyfung1031/userscript-supports/branches{/branch}",
"tags_url": "https://api.github.com/repos/cyfung1031/userscript-supports/tags",
"blobs_url": "https://api.github.com/repos/cyfung1031/userscript-supports/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/cyfung1031/userscript-supports/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/cyfung1031/userscript-supports/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/cyfung1031/userscript-supports/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/cyfung1031/userscript-supports/statuses/{sha}",
"languages_url": "https://api.github.com/repos/cyfung1031/userscript-supports/languages",
"stargazers_url": "https://api.github.com/repos/cyfung1031/userscript-supports/stargazers",
"contributors_url": "https://api.github.com/repos/cyfung1031/userscript-supports/contributors",
"subscribers_url": "https://api.github.com/repos/cyfung1031/userscript-supports/subscribers",
"subscription_url": "https://api.github.com/repos/cyfung1031/userscript-supports/subscription",
"commits_url": "https://api.github.com/repos/cyfung1031/userscript-supports/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/cyfung1031/userscript-supports/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/cyfung1031/userscript-supports/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/cyfung1031/userscript-supports/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/cyfung1031/userscript-supports/contents/{+path}",
"compare_url": "https://api.github.com/repos/cyfung1031/userscript-supports/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/cyfung1031/userscript-supports/merges",
"archive_url": "https://api.github.com/repos/cyfung1031/userscript-supports/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/cyfung1031/userscript-supports/downloads",
"issues_url": "https://api.github.com/repos/cyfung1031/userscript-supports/issues{/number}",
"pulls_url": "https://api.github.com/repos/cyfung1031/userscript-supports/pulls{/number}",
"milestones_url": "https://api.github.com/repos/cyfung1031/userscript-supports/milestones{/number}",
"notifications_url": "https://api.github.com/repos/cyfung1031/userscript-supports/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/cyfung1031/userscript-supports/labels{/name}",
"releases_url": "https://api.github.com/repos/cyfung1031/userscript-supports/releases{/id}",
"deployments_url": "https://api.github.com/repos/cyfung1031/userscript-supports/deployments",
"created_at": 1670675180,
"updated_at": "2025-03-22T13:49:04Z",
"pushed_at": 1742821222,
"git_url": "git://github.com/cyfung1031/userscript-supports.git",
"ssh_url": "[email protected]:cyfung1031/userscript-supports.git",
"clone_url": "https://github.com/cyfung1031/userscript-supports.git",
"svn_url": "https://github.com/cyfung1031/userscript-supports",
"homepage": "https://cyfung1031.github.io/userscript-supports/",
"size": 6742,
"stargazers_count": 65,
"watchers_count": 65,
"language": "CSS",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": true,
"has_discussions": true,
"forks_count": 6,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 10,
"license": {
"key": "mit",
"name": "MIT License",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit",
"node_id": "******"
},
"allow_forking": true,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [
"brave",
"chrome",
"edge",
"extension",
"firefox",
"opera",
"tampermonkey",
"userscript",
"violentmonkey",
"youtube"
],
"visibility": "public",
"forks": 6,
"open_issues": 10,
"watchers": 65,
"default_branch": "main",
"stargazers": 65,
"master_branch": "main"
},
"pusher": {
"name": "cyfung1031",
"email": "******"
},
"sender": {
"login": "cyfung1031",
"id": 44498510,
"node_id": "******",
"avatar_url": "https://avatars.githubusercontent.com/u/44498510?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/cyfung1031",
"html_url": "https://github.com/cyfung1031",
"followers_url": "https://api.github.com/users/cyfung1031/followers",
"following_url": "https://api.github.com/users/cyfung1031/following{/other_user}",
"gists_url": "https://api.github.com/users/cyfung1031/gists{/gist_id}",
"starred_url": "https://api.github.com/users/cyfung1031/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/cyfung1031/subscriptions",
"organizations_url": "https://api.github.com/users/cyfung1031/orgs",
"repos_url": "https://api.github.com/users/cyfung1031/repos",
"events_url": "https://api.github.com/users/cyfung1031/events{/privacy}",
"received_events_url": "https://api.github.com/users/cyfung1031/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
},
"created": false,
"deleted": false,
"forced": false,
"base_ref": null,
"compare": "https://github.com/cyfung1031/userscript-supports/compare/8b6620b0e8f3...1c59bf41be5d",
"commits": [
{
"id": "1c59bf41be5d4d41b1900dc11c8cbf9aa680c243",
"tree_id": "4bdbf21ca8da78e026b2aeff0a5f63e26e817b50",
"distinct": true,
"message": "YouTube JS Engine Tamer | Bug Fix",
"timestamp": "2025-03-24T22:00:20+09:00",
"url": "https://github.com/cyfung1031/userscript-supports/commit/1c59bf41be5d4d41b1900dc11c8cbf9aa680c243",
"author": {
"name": "cyfung1031",
"email": "******",
"username": "cyfung1031"
},
"committer": {
"name": "cyfung1031",
"email": "******",
"username": "cyfung1031"
},
"added": [],
"removed": [],
"modified": [
"473972.user.js"
]
}
],
"head_commit": {
"id": "1c59bf41be5d4d41b1900dc11c8cbf9aa680c243",
"tree_id": "4bdbf21ca8da78e026b2aeff0a5f63e26e817b50",
"distinct": true,
"message": "YouTube JS Engine Tamer | Bug Fix",
"timestamp": "2025-03-24T22:00:20+09:00",
"url": "https://github.com/cyfung1031/userscript-supports/commit/1c59bf41be5d4d41b1900dc11c8cbf9aa680c243",
"author": {
"name": "cyfung1031",
"email": "******",
"username": "cyfung1031"
},
"committer": {
"name": "cyfung1031",
"email": "******",
"username": "cyfung1031"
},
"added": [],
"removed": [],
"modified": [
"473972.user.js"
]
}
}
For a GitHub push event, in order to find a matching script for the webhook request, it's looking at this data:
- repository.url:
https://api.github.com/repos/cyfung1031/userscript-supports
- ref:
refs/heads/main
- commits.modified:
473972.user.js
It takes this data and transforms it as follows:
- For the repository URL, it translates to two possibilities:
https://api.github.com/repos/cyfung1031/userscript-supports/raw/
andhttps://raw.githubusercontent.com/repos/cyfung1031/
. - For ref, it strips
refs/head
, so it's justmain
. - Filename remains the same.
It concatenates those three things, so it will be looking for scripts with a sync URL of either https://api.github.com/repos/cyfung1031/userscript-supports/raw/main/473972.user.js
or https://raw.githubusercontent.com/repos/cyfung1031/main/473972.user.js
. Now, testing this URLs out, neither of them work.
Your script has an actual sync URL of https://raw.githubusercontent.com/cyfung1031/userscript-supports/refs/heads/main/473972.user.js
, which does work, and is the URL I get when browsing your report from GitHub.
I believe the thing that's changed here is that your repository.url is in the format https://api.github.com/repos/cyfung1031/userscript-supports
, while I just ran a test webhook on my repo and it was in the format https://github.com/JasonBarnabe/webhooktest
(and correctly matched my script). I could change the logic to instead look at respository.html_url
, but I would like to understand why yours is acting differently than mine.
Asked on the GitHub support site: https://github.com/orgs/community/discussions/155329
My webhook payload:
{
"ref": "refs/heads/master",
"before": "124f36d8ff2d03323f264d23d499f990e8916465",
"after": "e49e3a6079989e852d3be657aa140b4a90d69b09",
"repository": {
"id": 20602128,
"node_id": "MDEwOlJlcG9zaXRvcnkyMDYwMjEyOA==",
"name": "webhooktest",
"full_name": "JasonBarnabe/webhooktest",
"private": false,
"owner": {
"name": "JasonBarnabe",
"email": "[email protected]",
"login": "JasonBarnabe",
"id": 583995,
"node_id": "MDQ6VXNlcjU4Mzk5NQ==",
"avatar_url": "https://avatars.githubusercontent.com/u/583995?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JasonBarnabe",
"html_url": "https://github.com/JasonBarnabe",
"followers_url": "https://api.github.com/users/JasonBarnabe/followers",
"following_url": "https://api.github.com/users/JasonBarnabe/following{/other_user}",
"gists_url": "https://api.github.com/users/JasonBarnabe/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JasonBarnabe/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JasonBarnabe/subscriptions",
"organizations_url": "https://api.github.com/users/JasonBarnabe/orgs",
"repos_url": "https://api.github.com/users/JasonBarnabe/repos",
"events_url": "https://api.github.com/users/JasonBarnabe/events{/privacy}",
"received_events_url": "https://api.github.com/users/JasonBarnabe/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
},
"html_url": "https://github.com/JasonBarnabe/webhooktest",
"description": "Test repository for Greasy Fork/GitHub webhook",
"fork": false,
"url": "https://github.com/JasonBarnabe/webhooktest",
"forks_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/forks",
"keys_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/teams",
"hooks_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/hooks",
"issue_events_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/issues/events{/number}",
"events_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/events",
"assignees_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/assignees{/user}",
"branches_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/branches{/branch}",
"tags_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/tags",
"blobs_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/statuses/{sha}",
"languages_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/languages",
"stargazers_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/stargazers",
"contributors_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/contributors",
"subscribers_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/subscribers",
"subscription_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/subscription",
"commits_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/contents/{+path}",
"compare_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/merges",
"archive_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/downloads",
"issues_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/issues{/number}",
"pulls_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/pulls{/number}",
"milestones_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/milestones{/number}",
"notifications_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/labels{/name}",
"releases_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/releases{/id}",
"deployments_url": "https://api.github.com/repos/JasonBarnabe/webhooktest/deployments",
"created_at": 1402173110,
"updated_at": "2023-09-08T16:48:07Z",
"pushed_at": 1743265816,
"git_url": "git://github.com/JasonBarnabe/webhooktest.git",
"ssh_url": "[email protected]:JasonBarnabe/webhooktest.git",
"clone_url": "https://github.com/JasonBarnabe/webhooktest.git",
"svn_url": "https://github.com/JasonBarnabe/webhooktest",
"homepage": null,
"size": 58,
"stargazers_count": 1,
"watchers_count": 1,
"language": "JavaScript",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"has_discussions": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 0,
"license": null,
"allow_forking": true,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [
],
"visibility": "public",
"forks": 0,
"open_issues": 0,
"watchers": 1,
"default_branch": "master",
"stargazers": 1,
"master_branch": "master"
},
"pusher": {
"name": "JasonBarnabe",
"email": "[email protected]"
},
"sender": {
"login": "JasonBarnabe",
"id": 583995,
"node_id": "MDQ6VXNlcjU4Mzk5NQ==",
"avatar_url": "https://avatars.githubusercontent.com/u/583995?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/JasonBarnabe",
"html_url": "https://github.com/JasonBarnabe",
"followers_url": "https://api.github.com/users/JasonBarnabe/followers",
"following_url": "https://api.github.com/users/JasonBarnabe/following{/other_user}",
"gists_url": "https://api.github.com/users/JasonBarnabe/gists{/gist_id}",
"starred_url": "https://api.github.com/users/JasonBarnabe/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/JasonBarnabe/subscriptions",
"organizations_url": "https://api.github.com/users/JasonBarnabe/orgs",
"repos_url": "https://api.github.com/users/JasonBarnabe/repos",
"events_url": "https://api.github.com/users/JasonBarnabe/events{/privacy}",
"received_events_url": "https://api.github.com/users/JasonBarnabe/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false
},
"created": false,
"deleted": false,
"forced": false,
"base_ref": null,
"compare": "https://github.com/JasonBarnabe/webhooktest/compare/124f36d8ff2d...e49e3a607998",
"commits": [
{
"id": "e49e3a6079989e852d3be657aa140b4a90d69b09",
"tree_id": "8a4dd272b7d32c5b67db949c64f741be32b27d6c",
"distinct": true,
"message": "Update test.user.js\n\ntest webhook",
"timestamp": "2025-03-29T11:30:16-05:00",
"url": "https://github.com/JasonBarnabe/webhooktest/commit/e49e3a6079989e852d3be657aa140b4a90d69b09",
"author": {
"name": "Jason Barnabe",
"email": "[email protected]",
"username": "JasonBarnabe"
},
"committer": {
"name": "GitHub",
"email": "[email protected]",
"username": "web-flow"
},
"added": [
],
"removed": [
],
"modified": [
"test.user.js"
]
}
],
"head_commit": {
"id": "e49e3a6079989e852d3be657aa140b4a90d69b09",
"tree_id": "8a4dd272b7d32c5b67db949c64f741be32b27d6c",
"distinct": true,
"message": "Update test.user.js\n\ntest webhook",
"timestamp": "2025-03-29T11:30:16-05:00",
"url": "https://github.com/JasonBarnabe/webhooktest/commit/e49e3a6079989e852d3be657aa140b4a90d69b09",
"author": {
"name": "Jason Barnabe",
"email": "[email protected]",
"username": "JasonBarnabe"
},
"committer": {
"name": "GitHub",
"email": "[email protected]",
"username": "web-flow"
},
"added": [
],
"removed": [
],
"modified": [
"test.user.js"
]
}
}
No response from the GitHub community, so I've gone ahead and made the change to look at repository.html_url
. If you have further problems, let me know.
I checked that the response log in Github is 200, but the response body is different.
(Same script. no change of script namespace and script name)
2025-03-22 (normal. success)
2025-03-24 (200 response but failed)