ammen99 / github-irc-webhook

A simple python server to listen for Github webhooks and send IRC notifications
GNU General Public License v3.0
2 stars 3 forks source link

Pushing tags prints a weird message #2

Open emersion opened 5 years ago

emersion commented 5 years ago
Notice(emersion-bot): [emersion/go-smtp] emersion pushed 0 commit to v0.11.0 (https://git.io/fjIHs):
ammen99 commented 5 years ago

This is the information that Github sends. We could just ignore pushes with 0 commits?

emersion commented 5 years ago

v0.11.0 is not a branch, it's a tag. Maybe there's a type=tag field or something?

ammen99 commented 5 years ago

Can you send me the whole payload? It is visible in the webhook settings.

emersion commented 5 years ago
{
  "ref": "refs/tags/v0.11.0",
  "before": "0000000000000000000000000000000000000000",
  "after": "b818601bb57d1190ffc635d1b7922bdbd9301b18",
  "created": true,
  "deleted": false,
  "forced": false,
  "base_ref": null,
  "compare": "https://github.com/emersion/go-smtp/compare/v0.11.0",
  "commits": [

  ],
  "head_commit": {
    "id": "93209ab8b4b95869e2501db911d9b3767af90c11",
    "tree_id": "95251667230574a3ac8ee7ecd056fcd816eb6242",
    "distinct": true,
    "message": "Update README.md\n\nFix typo in server example",
    "timestamp": "2019-04-03T09:12:16+03:00",
    "url": "https://github.com/emersion/go-smtp/commit/93209ab8b4b95869e2501db911d9b3767af90c11",
    "author": {
      "name": "fox.cpp",
      "email": "fox.cpp@disroot.org",
      "username": "foxcpp"
    },
    "committer": {
      "name": "emersion",
      "email": "contact@emersion.fr",
      "username": "emersion"
    },
    "added": [

    ],
    "removed": [

    ],
    "modified": [
      "README.md"
    ]
  },
  "repository": {
    "id": 63762408,
    "node_id": "MDEwOlJlcG9zaXRvcnk2Mzc2MjQwOA==",
    "name": "go-smtp",
    "full_name": "emersion/go-smtp",
    "private": false,
    "owner": {
      "name": "emersion",
      "email": "contact@emersion.fr",
      "login": "emersion",
      "id": 506932,
      "node_id": "MDQ6VXNlcjUwNjkzMg==",
      "avatar_url": "https://avatars1.githubusercontent.com/u/506932?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/emersion",
      "html_url": "https://github.com/emersion",
      "followers_url": "https://api.github.com/users/emersion/followers",
      "following_url": "https://api.github.com/users/emersion/following{/other_user}",
      "gists_url": "https://api.github.com/users/emersion/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/emersion/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/emersion/subscriptions",
      "organizations_url": "https://api.github.com/users/emersion/orgs",
      "repos_url": "https://api.github.com/users/emersion/repos",
      "events_url": "https://api.github.com/users/emersion/events{/privacy}",
      "received_events_url": "https://api.github.com/users/emersion/received_events",
      "type": "User",
      "site_admin": false
    },
    "html_url": "https://github.com/emersion/go-smtp",
    "description": ":outbox_tray: An SMTP client & server library written in Go",
    "fork": false,
    "url": "https://github.com/emersion/go-smtp",
    "forks_url": "https://api.github.com/repos/emersion/go-smtp/forks",
    "keys_url": "https://api.github.com/repos/emersion/go-smtp/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/emersion/go-smtp/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/emersion/go-smtp/teams",
    "hooks_url": "https://api.github.com/repos/emersion/go-smtp/hooks",
    "issue_events_url": "https://api.github.com/repos/emersion/go-smtp/issues/events{/number}",
    "events_url": "https://api.github.com/repos/emersion/go-smtp/events",
    "assignees_url": "https://api.github.com/repos/emersion/go-smtp/assignees{/user}",
    "branches_url": "https://api.github.com/repos/emersion/go-smtp/branches{/branch}",
    "tags_url": "https://api.github.com/repos/emersion/go-smtp/tags",
    "blobs_url": "https://api.github.com/repos/emersion/go-smtp/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/emersion/go-smtp/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/emersion/go-smtp/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/emersion/go-smtp/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/emersion/go-smtp/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/emersion/go-smtp/languages",
    "stargazers_url": "https://api.github.com/repos/emersion/go-smtp/stargazers",
    "contributors_url": "https://api.github.com/repos/emersion/go-smtp/contributors",
    "subscribers_url": "https://api.github.com/repos/emersion/go-smtp/subscribers",
    "subscription_url": "https://api.github.com/repos/emersion/go-smtp/subscription",
    "commits_url": "https://api.github.com/repos/emersion/go-smtp/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/emersion/go-smtp/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/emersion/go-smtp/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/emersion/go-smtp/issues/comments{/number}",
    "contents_url": "https://api.github.com/repos/emersion/go-smtp/contents/{+path}",
    "compare_url": "https://api.github.com/repos/emersion/go-smtp/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/emersion/go-smtp/merges",
    "archive_url": "https://api.github.com/repos/emersion/go-smtp/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/emersion/go-smtp/downloads",
    "issues_url": "https://api.github.com/repos/emersion/go-smtp/issues{/number}",
    "pulls_url": "https://api.github.com/repos/emersion/go-smtp/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/emersion/go-smtp/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/emersion/go-smtp/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/emersion/go-smtp/labels{/name}",
    "releases_url": "https://api.github.com/repos/emersion/go-smtp/releases{/id}",
    "deployments_url": "https://api.github.com/repos/emersion/go-smtp/deployments",
    "created_at": 1469001612,
    "updated_at": "2019-04-03T13:06:05Z",
    "pushed_at": 1554309156,
    "git_url": "git://github.com/emersion/go-smtp.git",
    "ssh_url": "git@github.com:emersion/go-smtp.git",
    "clone_url": "https://github.com/emersion/go-smtp.git",
    "svn_url": "https://github.com/emersion/go-smtp",
    "homepage": "",
    "size": 409,
    "stargazers_count": 181,
    "watchers_count": 181,
    "language": "Go",
    "has_issues": true,
    "has_projects": false,
    "has_downloads": true,
    "has_wiki": false,
    "has_pages": false,
    "forks_count": 41,
    "mirror_url": null,
    "archived": false,
    "disabled": false,
    "open_issues_count": 4,
    "license": {
      "key": "mit",
      "name": "MIT License",
      "spdx_id": "MIT",
      "url": "https://api.github.com/licenses/mit",
      "node_id": "MDc6TGljZW5zZTEz"
    },
    "forks": 41,
    "open_issues": 4,
    "watchers": 181,
    "default_branch": "master",
    "stargazers": 181,
    "master_branch": "master"
  },
  "pusher": {
    "name": "emersion",
    "email": "contact@emersion.fr"
  },
  "sender": {
    "login": "emersion",
    "id": 506932,
    "node_id": "MDQ6VXNlcjUwNjkzMg==",
    "avatar_url": "https://avatars1.githubusercontent.com/u/506932?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/emersion",
    "html_url": "https://github.com/emersion",
    "followers_url": "https://api.github.com/users/emersion/followers",
    "following_url": "https://api.github.com/users/emersion/following{/other_user}",
    "gists_url": "https://api.github.com/users/emersion/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/emersion/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/emersion/subscriptions",
    "organizations_url": "https://api.github.com/users/emersion/orgs",
    "repos_url": "https://api.github.com/users/emersion/repos",
    "events_url": "https://api.github.com/users/emersion/events{/privacy}",
    "received_events_url": "https://api.github.com/users/emersion/received_events",
    "type": "User",
    "site_admin": false
  }
}
ammen99 commented 5 years ago

Ok, there doesn't seem to be anything that special, except the fact that the before commit is 000000. Maybe the bot should take such messages as a "created" event, because IIRC the same happens for when a branch is created.