discord-csharp / DiscordWebhookProxy

DiscordWebhookProxy is a simple proxy that extends the discord built in github and slack webhook endpoints, allowing for customized content additional supported services.
MIT License
0 stars 0 forks source link

Map "push" event #8

Open Cisien opened 3 years ago

Cisien commented 3 years ago

Identified as a push event by the ref/before/after properties (maybe?) or by looking at the X-GitHub-Event: push header

Data:

{
  "ref": "refs/heads/main",
  "before": "95178d7634d48811249ab8a4e94cd514aca0e206",
  "after": "c402dfc8643a34251cdabf0d1188509cd24338c7",
  "repository": {
    "id": 87733227,
    "node_id": "MDEwOlJlcG9zaXRvcnk4NzczMzIyNw==",
    "name": "CSharpRepl",
    "full_name": "discord-csharp/CSharpRepl",
    "private": false,
    "owner": {
      "name": "discord-csharp",
      "email": null,
      "login": "discord-csharp",
      "id": 19499857,
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjE5NDk5ODU3",
      "avatar_url": "https://avatars.githubusercontent.com/u/19499857?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/discord-csharp",
      "html_url": "https://github.com/discord-csharp",
      "followers_url": "https://api.github.com/users/discord-csharp/followers",
      "following_url": "https://api.github.com/users/discord-csharp/following{/other_user}",
      "gists_url": "https://api.github.com/users/discord-csharp/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/discord-csharp/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/discord-csharp/subscriptions",
      "organizations_url": "https://api.github.com/users/discord-csharp/orgs",
      "repos_url": "https://api.github.com/users/discord-csharp/repos",
      "events_url": "https://api.github.com/users/discord-csharp/events{/privacy}",
      "received_events_url": "https://api.github.com/users/discord-csharp/received_events",
      "type": "Organization",
      "site_admin": false
    },
    "html_url": "https://github.com/discord-csharp/CSharpRepl",
    "description": "CSharpRepl is a web api for C# REPL using the Roslyn Scripting APIs",
    "fork": false,
    "url": "https://github.com/discord-csharp/CSharpRepl",
    "forks_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/forks",
    "keys_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/teams",
    "hooks_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/hooks",
    "issue_events_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/issues/events{/number}",
    "events_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/events",
    "assignees_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/assignees{/user}",
    "branches_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/branches{/branch}",
    "tags_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/tags",
    "blobs_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/languages",
    "stargazers_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/stargazers",
    "contributors_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/contributors",
    "subscribers_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/subscribers",
    "subscription_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/subscription",
    "commits_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/issues/comments{/number}",
    "contents_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/contents/{+path}",
    "compare_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/merges",
    "archive_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/downloads",
    "issues_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/issues{/number}",
    "pulls_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/labels{/name}",
    "releases_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/releases{/id}",
    "deployments_url": "https://api.github.com/repos/discord-csharp/CSharpRepl/deployments",
    "created_at": 1491765663,
    "updated_at": "2021-07-11T16:57:46Z",
    "pushed_at": 1626032819,
    "git_url": "git://github.com/discord-csharp/CSharpRepl.git",
    "ssh_url": "git@github.com:discord-csharp/CSharpRepl.git",
    "clone_url": "https://github.com/discord-csharp/CSharpRepl.git",
    "svn_url": "https://github.com/discord-csharp/CSharpRepl",
    "homepage": "",
    "size": 317,
    "stargazers_count": 14,
    "watchers_count": 14,
    "language": "C#",
    "has_issues": true,
    "has_projects": true,
    "has_downloads": true,
    "has_wiki": true,
    "has_pages": false,
    "forks_count": 12,
    "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"
    },
    "forks": 12,
    "open_issues": 0,
    "watchers": 14,
    "default_branch": "main",
    "stargazers": 14,
    "master_branch": "main",
    "organization": "discord-csharp"
  },
  "pusher": {
    "name": "Cisien",
    "email": "Cisien@users.noreply.github.com"
  },
  "organization": {
    "login": "discord-csharp",
    "id": 19499857,
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjE5NDk5ODU3",
    "url": "https://api.github.com/orgs/discord-csharp",
    "repos_url": "https://api.github.com/orgs/discord-csharp/repos",
    "events_url": "https://api.github.com/orgs/discord-csharp/events",
    "hooks_url": "https://api.github.com/orgs/discord-csharp/hooks",
    "issues_url": "https://api.github.com/orgs/discord-csharp/issues",
    "members_url": "https://api.github.com/orgs/discord-csharp/members{/member}",
    "public_members_url": "https://api.github.com/orgs/discord-csharp/public_members{/member}",
    "avatar_url": "https://avatars.githubusercontent.com/u/19499857?v=4",
    "description": ""
  },
  "sender": {
    "login": "Cisien",
    "id": 4044356,
    "node_id": "MDQ6VXNlcjQwNDQzNTY=",
    "avatar_url": "https://avatars.githubusercontent.com/u/4044356?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/Cisien",
    "html_url": "https://github.com/Cisien",
    "followers_url": "https://api.github.com/users/Cisien/followers",
    "following_url": "https://api.github.com/users/Cisien/following{/other_user}",
    "gists_url": "https://api.github.com/users/Cisien/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/Cisien/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/Cisien/subscriptions",
    "organizations_url": "https://api.github.com/users/Cisien/orgs",
    "repos_url": "https://api.github.com/users/Cisien/repos",
    "events_url": "https://api.github.com/users/Cisien/events{/privacy}",
    "received_events_url": "https://api.github.com/users/Cisien/received_events",
    "type": "User",
    "site_admin": false
  },
  "created": false,
  "deleted": false,
  "forced": false,
  "base_ref": null,
  "compare": "https://github.com/discord-csharp/CSharpRepl/compare/95178d7634d4...c402dfc8643a",
  "commits": [
    {
      "id": "c402dfc8643a34251cdabf0d1188509cd24338c7",
      "tree_id": "d22d9625d3abaf5258bf81ced0f9a79e959f27c0",
      "distinct": true,
      "message": "Fix attribution in readme",
      "timestamp": "2021-07-11T12:46:59-07:00",
      "url": "https://github.com/discord-csharp/CSharpRepl/commit/c402dfc8643a34251cdabf0d1188509cd24338c7",
      "author": {
        "name": "Chris",
        "email": "Cisien@users.noreply.github.com",
        "username": "Cisien"
      },
      "committer": {
        "name": "GitHub",
        "email": "noreply@github.com",
        "username": "web-flow"
      },
      "added": [

      ],
      "removed": [

      ],
      "modified": [
        "README.md"
      ]
    }
  ],
  "head_commit": {
    "id": "c402dfc8643a34251cdabf0d1188509cd24338c7",
    "tree_id": "d22d9625d3abaf5258bf81ced0f9a79e959f27c0",
    "distinct": true,
    "message": "Fix attribution in readme",
    "timestamp": "2021-07-11T12:46:59-07:00",
    "url": "https://github.com/discord-csharp/CSharpRepl/commit/c402dfc8643a34251cdabf0d1188509cd24338c7",
    "author": {
      "name": "Chris",
      "email": "Cisien@users.noreply.github.com",
      "username": "Cisien"
    },
    "committer": {
      "name": "GitHub",
      "email": "noreply@github.com",
      "username": "web-flow"
    },
    "added": [

    ],
    "removed": [

    ],
    "modified": [
      "README.md"
    ]
  }
}
Cisien commented 3 years ago

PR push event:

{
  "ref": "refs/heads/cisien/readme-pr",
  "before": "0000000000000000000000000000000000000000",
  "after": "386c993ec75517ec2c941fd121e6bd9264d5a76a",
  "repository": {
    "id": 384838976,
    "node_id": "MDEwOlJlcG9zaXRvcnkzODQ4Mzg5NzY=",
    "name": "DiscordWebhookProxy",
    "full_name": "discord-csharp/DiscordWebhookProxy",
    "private": false,
    "owner": {
      "name": "discord-csharp",
      "email": null,
      "login": "discord-csharp",
      "id": 19499857,
      "node_id": "MDEyOk9yZ2FuaXphdGlvbjE5NDk5ODU3",
      "avatar_url": "https://avatars.githubusercontent.com/u/19499857?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/discord-csharp",
      "html_url": "https://github.com/discord-csharp",
      "followers_url": "https://api.github.com/users/discord-csharp/followers",
      "following_url": "https://api.github.com/users/discord-csharp/following{/other_user}",
      "gists_url": "https://api.github.com/users/discord-csharp/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/discord-csharp/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/discord-csharp/subscriptions",
      "organizations_url": "https://api.github.com/users/discord-csharp/orgs",
      "repos_url": "https://api.github.com/users/discord-csharp/repos",
      "events_url": "https://api.github.com/users/discord-csharp/events{/privacy}",
      "received_events_url": "https://api.github.com/users/discord-csharp/received_events",
      "type": "Organization",
      "site_admin": false
    },
    "html_url": "https://github.com/discord-csharp/DiscordWebhookProxy",
    "description": "DiscordWebhookProxy is a simple proxy that extends the discord built in github and slack webhook endpoints, allowing for customized content additional supported services.",
    "fork": false,
    "url": "https://github.com/discord-csharp/DiscordWebhookProxy",
    "forks_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/forks",
    "keys_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/teams",
    "hooks_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/hooks",
    "issue_events_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/issues/events{/number}",
    "events_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/events",
    "assignees_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/assignees{/user}",
    "branches_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/branches{/branch}",
    "tags_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/tags",
    "blobs_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/languages",
    "stargazers_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/stargazers",
    "contributors_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/contributors",
    "subscribers_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/subscribers",
    "subscription_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/subscription",
    "commits_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/issues/comments{/number}",
    "contents_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/contents/{+path}",
    "compare_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/merges",
    "archive_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/downloads",
    "issues_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/issues{/number}",
    "pulls_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/labels{/name}",
    "releases_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/releases{/id}",
    "deployments_url": "https://api.github.com/repos/discord-csharp/DiscordWebhookProxy/deployments",
    "created_at": 1625967672,
    "updated_at": "2021-07-11T02:17:11Z",
    "pushed_at": 1626111462,
    "git_url": "git://github.com/discord-csharp/DiscordWebhookProxy.git",
    "ssh_url": "git@github.com:discord-csharp/DiscordWebhookProxy.git",
    "clone_url": "https://github.com/discord-csharp/DiscordWebhookProxy.git",
    "svn_url": "https://github.com/discord-csharp/DiscordWebhookProxy",
    "homepage": null,
    "size": 18,
    "stargazers_count": 0,
    "watchers_count": 0,
    "language": "C#",
    "has_issues": true,
    "has_projects": true,
    "has_downloads": true,
    "has_wiki": true,
    "has_pages": false,
    "forks_count": 0,
    "mirror_url": null,
    "archived": false,
    "disabled": false,
    "open_issues_count": 8,
    "license": {
      "key": "mit",
      "name": "MIT License",
      "spdx_id": "MIT",
      "url": "https://api.github.com/licenses/mit",
      "node_id": "MDc6TGljZW5zZTEz"
    },
    "forks": 0,
    "open_issues": 8,
    "watchers": 0,
    "default_branch": "main",
    "stargazers": 0,
    "master_branch": "main",
    "organization": "discord-csharp"
  },
  "pusher": {
    "name": "Cisien",
    "email": "Cisien@users.noreply.github.com"
  },
  "organization": {
    "login": "discord-csharp",
    "id": 19499857,
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjE5NDk5ODU3",
    "url": "https://api.github.com/orgs/discord-csharp",
    "repos_url": "https://api.github.com/orgs/discord-csharp/repos",
    "events_url": "https://api.github.com/orgs/discord-csharp/events",
    "hooks_url": "https://api.github.com/orgs/discord-csharp/hooks",
    "issues_url": "https://api.github.com/orgs/discord-csharp/issues",
    "members_url": "https://api.github.com/orgs/discord-csharp/members{/member}",
    "public_members_url": "https://api.github.com/orgs/discord-csharp/public_members{/member}",
    "avatar_url": "https://avatars.githubusercontent.com/u/19499857?v=4",
    "description": ""
  },
  "sender": {
    "login": "Cisien",
    "id": 4044356,
    "node_id": "MDQ6VXNlcjQwNDQzNTY=",
    "avatar_url": "https://avatars.githubusercontent.com/u/4044356?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/Cisien",
    "html_url": "https://github.com/Cisien",
    "followers_url": "https://api.github.com/users/Cisien/followers",
    "following_url": "https://api.github.com/users/Cisien/following{/other_user}",
    "gists_url": "https://api.github.com/users/Cisien/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/Cisien/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/Cisien/subscriptions",
    "organizations_url": "https://api.github.com/users/Cisien/orgs",
    "repos_url": "https://api.github.com/users/Cisien/repos",
    "events_url": "https://api.github.com/users/Cisien/events{/privacy}",
    "received_events_url": "https://api.github.com/users/Cisien/received_events",
    "type": "User",
    "site_admin": false
  },
  "created": true,
  "deleted": false,
  "forced": false,
  "base_ref": null,
  "compare": "https://github.com/discord-csharp/DiscordWebhookProxy/commit/386c993ec755",
  "commits": [
    {
      "id": "386c993ec75517ec2c941fd121e6bd9264d5a76a",
      "tree_id": "06a7b967551a0e6c64748ec2c02841c57c27dbd1",
      "distinct": true,
      "message": "Create README.md",
      "timestamp": "2021-07-12T10:37:42-07:00",
      "url": "https://github.com/discord-csharp/DiscordWebhookProxy/commit/386c993ec75517ec2c941fd121e6bd9264d5a76a",
      "author": {
        "name": "Chris",
        "email": "Cisien@users.noreply.github.com",
        "username": "Cisien"
      },
      "committer": {
        "name": "GitHub",
        "email": "noreply@github.com",
        "username": "web-flow"
      },
      "added": [
        "README.md"
      ],
      "removed": [

      ],
      "modified": [

      ]
    }
  ],
  "head_commit": {
    "id": "386c993ec75517ec2c941fd121e6bd9264d5a76a",
    "tree_id": "06a7b967551a0e6c64748ec2c02841c57c27dbd1",
    "distinct": true,
    "message": "Create README.md",
    "timestamp": "2021-07-12T10:37:42-07:00",
    "url": "https://github.com/discord-csharp/DiscordWebhookProxy/commit/386c993ec75517ec2c941fd121e6bd9264d5a76a",
    "author": {
      "name": "Chris",
      "email": "Cisien@users.noreply.github.com",
      "username": "Cisien"
    },
    "committer": {
      "name": "GitHub",
      "email": "noreply@github.com",
      "username": "web-flow"
    },
    "added": [
      "README.md"
    ],
    "removed": [

    ],
    "modified": [

    ]
  }
}