Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webhook not work #1211

Closed
a1mersnow opened this issue Nov 21, 2023 · 6 comments
Closed

webhook not work #1211

a1mersnow opened this issue Nov 21, 2023 · 6 comments

Comments

@a1mersnow
Copy link

a1mersnow commented Nov 21, 2023

Here is my settings of GitHub webhook:
image
image

When a release is created, released, published, it will send three requests:
image
However, the last one always failed.

And, there is no error message telling me why:
image

Request

Request URL: https://greasyfork.org/zh-CN/users/1213223-a1mersnow/webhook
Request method: POST
Accept: */*
Content-Type: application/json
User-Agent: GitHub-Hookshot/312c994
X-GitHub-Delivery: b6f76010-879b-11ee-9fb8-0d19e21c842a
X-GitHub-Event: release
X-GitHub-Hook-ID: 442184950
X-GitHub-Hook-Installation-Target-ID: 715969185
X-GitHub-Hook-Installation-Target-Type: repository
X-Hub-Signature: sha1=2f972353e74b70fc83e7dc401aafd54e541ae9fa
X-Hub-Signature-256: sha256=de47908797dc959a70f0a9044dfa1937b0adce90cc3e431ba8f2f0fb1d6e02f1

{
  "action": "published",
  "release": {
    "url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/releases/130333374",
    "assets_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/releases/130333374/assets",
    "upload_url": "https://uploads.github.com/repos/a1mersnow/aliyundrive-rename/releases/130333374/assets{?name,label}",
    "html_url": "https://github.com/a1mersnow/aliyundrive-rename/releases/tag/0.2.5",
    "id": 130333374,
    "author": {
      "login": "github-actions[bot]",
      "id": 41898282,
      "node_id": "MDM6Qm90NDE4OTgyODI=",
      "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/github-actions%5Bbot%5D",
      "html_url": "https://github.com/apps/github-actions",
      "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
      "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
      "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
      "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
      "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
      "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
      "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
      "type": "Bot",
      "site_admin": false
    },
    "node_id": "RE_kwDOKqzSoc4HxLq-",
    "tag_name": "0.2.5",
    "target_commitish": "main",
    "name": "0.2.5",
    "draft": false,
    "prerelease": false,
    "created_at": "2023-11-20T11:54:49Z",
    "published_at": "2023-11-20T11:55:35Z",
    "assets": [

    ],
    "tarball_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/tarball/0.2.5",
    "zipball_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/zipball/0.2.5",
    "body": ""
  },
  "repository": {
    "id": 715969185,
    "node_id": "R_kgDOKqzSoQ",
    "name": "aliyundrive-rename",
    "full_name": "a1mersnow/aliyundrive-rename",
    "private": false,
    "owner": {
      "login": "a1mersnow",
      "id": 13799160,
      "node_id": "MDQ6VXNlcjEzNzk5MTYw",
      "avatar_url": "https://avatars.githubusercontent.com/u/13799160?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/a1mersnow",
      "html_url": "https://github.com/a1mersnow",
      "followers_url": "https://api.github.com/users/a1mersnow/followers",
      "following_url": "https://api.github.com/users/a1mersnow/following{/other_user}",
      "gists_url": "https://api.github.com/users/a1mersnow/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/a1mersnow/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/a1mersnow/subscriptions",
      "organizations_url": "https://api.github.com/users/a1mersnow/orgs",
      "repos_url": "https://api.github.com/users/a1mersnow/repos",
      "events_url": "https://api.github.com/users/a1mersnow/events{/privacy}",
      "received_events_url": "https://api.github.com/users/a1mersnow/received_events",
      "type": "User",
      "site_admin": false
    },
    "html_url": "https://github.com/a1mersnow/aliyundrive-rename",
    "description": "Aliyun Drive batch rename Tampermonkey script",
    "fork": false,
    "url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename",
    "forks_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/forks",
    "keys_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/teams",
    "hooks_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/hooks",
    "issue_events_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/issues/events{/number}",
    "events_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/events",
    "assignees_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/assignees{/user}",
    "branches_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/branches{/branch}",
    "tags_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/tags",
    "blobs_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/languages",
    "stargazers_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/stargazers",
    "contributors_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/contributors",
    "subscribers_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/subscribers",
    "subscription_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/subscription",
    "commits_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/issues/comments{/number}",
    "contents_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/contents/{+path}",
    "compare_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/merges",
    "archive_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/downloads",
    "issues_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/issues{/number}",
    "pulls_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/labels{/name}",
    "releases_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/releases{/id}",
    "deployments_url": "https://api.github.com/repos/a1mersnow/aliyundrive-rename/deployments",
    "created_at": "2023-11-08T07:50:03Z",
    "updated_at": "2023-11-19T02:18:27Z",
    "pushed_at": "2023-11-20T11:55:09Z",
    "git_url": "git://github.com/a1mersnow/aliyundrive-rename.git",
    "ssh_url": "git@github.com:a1mersnow/aliyundrive-rename.git",
    "clone_url": "https://github.com/a1mersnow/aliyundrive-rename.git",
    "svn_url": "https://github.com/a1mersnow/aliyundrive-rename",
    "homepage": null,
    "size": 1446,
    "stargazers_count": 1,
    "watchers_count": 1,
    "language": "TypeScript",
    "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": {
      "key": "mit",
      "name": "MIT License",
      "spdx_id": "MIT",
      "url": "https://api.github.com/licenses/mit",
      "node_id": "MDc6TGljZW5zZTEz"
    },
    "allow_forking": true,
    "is_template": false,
    "web_commit_signoff_required": false,
    "topics": [

    ],
    "visibility": "public",
    "forks": 0,
    "open_issues": 0,
    "watchers": 1,
    "default_branch": "main"
  },
  "sender": {
    "login": "github-actions[bot]",
    "id": 41898282,
    "node_id": "MDM6Qm90NDE4OTgyODI=",
    "avatar_url": "https://avatars.githubusercontent.com/in/15368?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/github-actions%5Bbot%5D",
    "html_url": "https://github.com/apps/github-actions",
    "followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
    "following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
    "gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
    "organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
    "repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
    "events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
    "received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
    "type": "Bot",
    "site_admin": false
  }
}

Response

Content-Length: 0
Content-Type: text/html; charset=UTF-8
Date: Mon, 20 Nov 2023 11:55:36 GMT
Server: nginx/1.18.0 (Ubuntu)
X-Request-Id: 03263401-6183-401d-b88a-c79be953d603
X-Runtime: 0.551056
@JasonBarnabe
Copy link
Collaborator

F, [2023-11-20T11:55:36.696751 #1280047] FATAL -- : [03263401-6183-401d-b88a-c79be953d603]   
[03263401-6183-401d-b88a-c79be953d603] RuntimeError (fatal: Path 'aliyundrive-rename.user.js' does not exist in '0.2.5'
):
[03263401-6183-401d-b88a-c79be953d603]   
[03263401-6183-401d-b88a-c79be953d603] lib/git.rb:10:in `block (2 levels) in get_contents'
[03263401-6183-401d-b88a-c79be953d603] lib/git.rb:8:in `each'
[03263401-6183-401d-b88a-c79be953d603] lib/git.rb:8:in `block in get_contents'
[03263401-6183-401d-b88a-c79be953d603] lib/git.rb:36:in `with_repo'
[03263401-6183-401d-b88a-c79be953d603] lib/git.rb:7:in `get_contents'
[03263401-6183-401d-b88a-c79be953d603] app/controllers/concerns/webhooks.rb:140:in `process_webhook_changes'
[03263401-6183-401d-b88a-c79be953d603] app/controllers/users_controller.rb:143:in `webhook'

@JasonBarnabe
Copy link
Collaborator

It's expecting to find the file in git. It's doing git show 0.2.5:aliyundrive-rename.user.js, but looking at your repo, that file exists only as an attachment to the release and is not in git itself.

@JasonBarnabe
Copy link
Collaborator

I've made a change so that you get a better message in this scenario.

I'm not sure what exactly to do here though... The expected input is a URL on GitHub that can be translated to a path in a GitHub repo. Maybe it needs to detect if something is a release URL and if so, just download it from the release path?

@a1mersnow
Copy link
Author

a1mersnow commented Nov 24, 2023

First of all, the script is a compilation result, the /dist dir shouldn't be commited to the git.

I think you can directly download the script from the "sync url" I have configed in the website when the webhook request hit the website server.

image

Sorry, I don't known ruby language so I can't compose a PR.

@cyfung1031
Copy link
Contributor

cyfung1031 commented Nov 25, 2023

@a1mersnow
Copy link
Author

This is a push solution.

For anyone who want to know how to setup webhook for release, you can refer to my repo, I wrote a release script for this.

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

No branches or pull requests

3 participants