From 5170aa4fc765c311d2820975a76dc3605831bd6c Mon Sep 17 00:00:00 2001 From: Izak Lipnik Date: Thu, 12 Oct 2017 12:28:18 +0200 Subject: [PATCH] fix(): show correct data when new tag is pushed --- .../app-build-details.component.ts | 3 +- .../app-build-item.component.html | 4 +- .../app-build-item.component.ts | 3 +- .../components/app-job/app-job.component.ts | 3 +- src/app/testing/xhr-data/build-tag.json | 278 ++++++++++++++++++ tests/dev-scripts/data/push-d3-tag.json | 156 ++++++++++ tests/dev-scripts/push-d3-tag.js | 23 ++ 7 files changed, 465 insertions(+), 5 deletions(-) create mode 100644 src/app/testing/xhr-data/build-tag.json create mode 100644 tests/dev-scripts/data/push-d3-tag.json create mode 100644 tests/dev-scripts/push-d3-tag.js diff --git a/src/app/components/app-build-details/app-build-details.component.ts b/src/app/components/app-build-details/app-build-details.component.ts index f17847f00..d5bf42af3 100644 --- a/src/app/components/app-build-details/app-build-details.component.ts +++ b/src/app/components/app-build-details/app-build-details.component.ts @@ -269,12 +269,13 @@ export class AppBuildDetailsComponent implements OnInit, OnDestroy { this.dateTime = data.pull_request && data.pull_request.updated_at || data.commit && data.commit.author && data.commit.author.date || data.commits && data.commits[data.commits.length - 1] && data.commits[data.commits.length - 1].timestamp || + data.head_commit && data.head_commit.timestamp || null; if (this.build.repository.repository_provider === 'github') { if (this.build.data.commit) { this.commitMessage = this.build.data.commit.message; - } else if (this.build.data.commits) { + } else if (this.build.data.commits && this.build.data.commits.length > 0) { const len = this.build.data.commits.length - 1; this.commitMessage = this.build.data.commits[len].message; } else if (this.build.data.pull_request && this.build.data.pull_request.title) { diff --git a/src/app/components/app-build-item/app-build-item.component.html b/src/app/components/app-build-item/app-build-item.component.html index 4bf27a683..87ef247de 100644 --- a/src/app/components/app-build-item/app-build-item.component.html +++ b/src/app/components/app-build-item/app-build-item.component.html @@ -42,7 +42,7 @@ {{ name }} {{ build?.data?.actor?.display_name }} {{ build?.data?.user?.name }} - {{ build?.data?.head_commit?.comitter?.name }} + {{ build?.data?.head_commit?.committer?.name }} {{ build?.data?.user_name }} {{ build?.data?.pusher?.username }} {{ build?.data?.pull_request?.user?.username }} @@ -72,7 +72,7 @@ {{ name }} {{ build?.data?.actor?.display_name }} {{ build?.data?.user?.name }} - {{ build?.data?.head_commit?.comitter?.name }} + {{ build?.data?.head_commit?.committer?.name }} {{ build?.repository?.full_name }} {{ build?.data?.repository?.full_name }} diff --git a/src/app/components/app-build-item/app-build-item.component.ts b/src/app/components/app-build-item/app-build-item.component.ts index 0e9d731bf..820551b25 100644 --- a/src/app/components/app-build-item/app-build-item.component.ts +++ b/src/app/components/app-build-item/app-build-item.component.ts @@ -63,12 +63,13 @@ export class AppBuildItemComponent implements OnInit { this.dateTime = data.pull_request && data.pull_request.updated_at || data.commit && data.commit.author && data.commit.author.date || data.commits && data.commits[data.commits.length - 1] && data.commits[data.commits.length - 1].timestamp || + data.head_commit && data.head_commit.timestamp || null; if (this.build.repository.repository_provider === 'github') { if (this.build.data.commit) { this.commitMessage = this.build.data.commit.message; - } else if (this.build.data.commits) { + } else if (this.build.data.commits && this.build.data.commits.length > 0) { const len = this.build.data.commits.length - 1; this.commitMessage = this.build.data.commits[len].message; } else if (this.build.data.pull_request && this.build.data.pull_request.title) { diff --git a/src/app/components/app-job/app-job.component.ts b/src/app/components/app-job/app-job.component.ts index d4881243d..421712616 100644 --- a/src/app/components/app-job/app-job.component.ts +++ b/src/app/components/app-job/app-job.component.ts @@ -211,12 +211,13 @@ export class AppJobComponent implements OnInit, OnDestroy { this.dateTime = data.pull_request && data.pull_request.updated_at || data.commit && data.commit.author && data.commit.author.date || data.commits && data.commits[data.commits.length - 1] && data.commits[data.commits.length - 1].timestamp || + data.head_commit && data.head_commit.timestamp || null; if (this.job.build.repository.repository_provider === 'github') { if (this.job.build.data.commit) { this.commitMessage = this.job.build.data.commit.message; - } else if (this.job.build.data.commits) { + } else if (this.job.build.data.commits && this.job.build.data.commits.length > 0) { const len = this.job.build.data.commits.length - 1; this.commitMessage = this.job.build.data.commits[len].message; } else if (this.job.build.data.pull_request && this.job.build.data.pull_request.title) { diff --git a/src/app/testing/xhr-data/build-tag.json b/src/app/testing/xhr-data/build-tag.json new file mode 100644 index 000000000..332022da4 --- /dev/null +++ b/src/app/testing/xhr-data/build-tag.json @@ -0,0 +1,278 @@ +{ + "data": { + "id": 500, + "branch": "0.0.1", + "pr": null, + "head_id": null, + "data": { + "ref": "refs/tags/0.0.1", + "before": "0000000000000000000000000000000000000000", + "after": "1f3e9ce9bae91202f7186644b7038405865b92bb", + "created": true, + "deleted": false, + "forced": false, + "base_ref": "refs/heads/master", + "compare": "https://github.com/Izak88/d3-bundle/compare/0.0.1", + "commits": [], + "head_commit": { + "id": "1f3e9ce9bae91202f7186644b7038405865b92bb", + "tree_id": "88ed9c20b1ac9e7438fef1348ae971c71b0cee74", + "distinct": true, + "message": "add jenkins file", + "timestamp": "2017-09-13T08:04:46+02:00", + "url": "https://github.com/Izak88/d3-bundle/commit/1f3e9ce9bae91202f7186644b7038405865b92bb", + "author": { + "name": "Izak Lipnik", + "email": "izak.lipnik@gmail.com", + "username": "Izak88" + }, + "committer": { + "name": "Izak Lipnik", + "email": "izak.lipnik@gmail.com", + "username": "Izak88" + }, + "added": [ + "jenkinsfile" + ], + "removed": [], + "modified": [] + }, + "repository": { + "id": 99934351, + "name": "d3-bundle", + "full_name": "Izak88/d3-bundle", + "owner": { + "name": "Izak88", + "email": "izak.lipnik@gmail.com", + "login": "Izak88", + "id": 8555269, + "avatar_url": "https://avatars0.githubusercontent.com/u/8555269?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Izak88", + "html_url": "https://github.com/Izak88", + "followers_url": "https://api.github.com/users/Izak88/followers", + "following_url": "https://api.github.com/users/Izak88/following{/other_user}", + "gists_url": "https://api.github.com/users/Izak88/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Izak88/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Izak88/subscriptions", + "organizations_url": "https://api.github.com/users/Izak88/orgs", + "repos_url": "https://api.github.com/users/Izak88/repos", + "events_url": "https://api.github.com/users/Izak88/events{/privacy}", + "received_events_url": "https://api.github.com/users/Izak88/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/Izak88/d3-bundle", + "description": null, + "fork": true, + "url": "https://github.com/Izak88/d3-bundle", + "forks_url": "https://api.github.com/repos/Izak88/d3-bundle/forks", + "keys_url": "https://api.github.com/repos/Izak88/d3-bundle/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/Izak88/d3-bundle/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/Izak88/d3-bundle/teams", + "hooks_url": "https://api.github.com/repos/Izak88/d3-bundle/hooks", + "issue_events_url": "https://api.github.com/repos/Izak88/d3-bundle/issues/events{/number}", + "events_url": "https://api.github.com/repos/Izak88/d3-bundle/events", + "assignees_url": "https://api.github.com/repos/Izak88/d3-bundle/assignees{/user}", + "branches_url": "https://api.github.com/repos/Izak88/d3-bundle/branches{/branch}", + "tags_url": "https://api.github.com/repos/Izak88/d3-bundle/tags", + "blobs_url": "https://api.github.com/repos/Izak88/d3-bundle/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/Izak88/d3-bundle/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/Izak88/d3-bundle/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/Izak88/d3-bundle/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/Izak88/d3-bundle/statuses/{sha}", + "languages_url": "https://api.github.com/repos/Izak88/d3-bundle/languages", + "stargazers_url": "https://api.github.com/repos/Izak88/d3-bundle/stargazers", + "contributors_url": "https://api.github.com/repos/Izak88/d3-bundle/contributors", + "subscribers_url": "https://api.github.com/repos/Izak88/d3-bundle/subscribers", + "subscription_url": "https://api.github.com/repos/Izak88/d3-bundle/subscription", + "commits_url": "https://api.github.com/repos/Izak88/d3-bundle/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/Izak88/d3-bundle/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/Izak88/d3-bundle/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/Izak88/d3-bundle/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/Izak88/d3-bundle/contents/{+path}", + "compare_url": "https://api.github.com/repos/Izak88/d3-bundle/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/Izak88/d3-bundle/merges", + "archive_url": "https://api.github.com/repos/Izak88/d3-bundle/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/Izak88/d3-bundle/downloads", + "issues_url": "https://api.github.com/repos/Izak88/d3-bundle/issues{/number}", + "pulls_url": "https://api.github.com/repos/Izak88/d3-bundle/pulls{/number}", + "milestones_url": "https://api.github.com/repos/Izak88/d3-bundle/milestones{/number}", + "notifications_url": "https://api.github.com/repos/Izak88/d3-bundle/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/Izak88/d3-bundle/labels{/name}", + "releases_url": "https://api.github.com/repos/Izak88/d3-bundle/releases{/id}", + "deployments_url": "https://api.github.com/repos/Izak88/d3-bundle/deployments", + "created_at": 1502376699, + "updated_at": "2017-08-10T14:51:46Z", + "pushed_at": 1507800333, + "git_url": "git://github.com/Izak88/d3-bundle.git", + "ssh_url": "git@github.com:Izak88/d3-bundle.git", + "clone_url": "https://github.com/Izak88/d3-bundle.git", + "svn_url": "https://github.com/Izak88/d3-bundle", + "homepage": null, + "size": 34622, + "stargazers_count": 0, + "watchers_count": 0, + "language": "JavaScript", + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 0, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "stargazers": 0, + "master_branch": "master" + }, + "pusher": { + "name": "Izak88", + "email": "izak.lipnik@gmail.com" + }, + "sender": { + "login": "Izak88", + "id": 8555269, + "avatar_url": "https://avatars0.githubusercontent.com/u/8555269?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Izak88", + "html_url": "https://github.com/Izak88", + "followers_url": "https://api.github.com/users/Izak88/followers", + "following_url": "https://api.github.com/users/Izak88/following{/other_user}", + "gists_url": "https://api.github.com/users/Izak88/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Izak88/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Izak88/subscriptions", + "organizations_url": "https://api.github.com/users/Izak88/orgs", + "repos_url": "https://api.github.com/users/Izak88/repos", + "events_url": "https://api.github.com/users/Izak88/events{/privacy}", + "received_events_url": "https://api.github.com/users/Izak88/received_events", + "type": "User", + "site_admin": false + } + }, + "parsed_config": "[{\"commands\":[{\"command\":\"git clone -q https://github.com/Izak88/d3-bundle.git -b 0.0.1 .\",\"type\":\"git\"},{\"command\":\"git fetch origin 0.0.1\",\"type\":\"git\"},{\"command\":\"git checkout 1f3e9ce9bae91202f7186644b7038405865b92bb .\",\"type\":\"git\"},{\"command\":\"npm install\",\"type\":\"install\"}],\"env\":[\"SCRIPT=test\"],\"stage\":\"test\",\"image\":null,\"cache\":null}]", + "start_time": 1507800334520, + "end_time": 1507800338929, + "repositories_id": 9, + "created_at": 1507800338403, + "updated_at": 1507800339106, + "repository": { + "id": 9, + "github_id": 99934351, + "bitbucket_id": null, + "gitlab_id": null, + "gogs_id": null, + "clone_url": "https://github.com/Izak88/d3-bundle.git", + "html_url": "https://github.com/Izak88/d3-bundle", + "default_branch": "master", + "name": "d3-bundle", + "full_name": "Izak88/d3-bundle", + "description": null, + "private": 0, + "fork": 1, + "user_login": "Izak88", + "user_id": "8555269", + "user_avatar_url": "https://avatars0.githubusercontent.com/u/8555269?v=4", + "user_url": "https://api.github.com/users/Izak88", + "user_html_url": "https://github.com/Izak88", + "access_tokens_id": null, + "public": 1, + "data": null, + "created_at": 1507800334380, + "updated_at": 1507800334380, + "repository_provider": "github", + "api_url": "https://api.github.com", + "permissions": [ + { + "id": 31, + "repositories_id": 9, + "users_id": 1, + "permission": 1, + "created_at": 1507800334417, + "updated_at": 1507800334417 + } + ], + "access_token": null + }, + "jobs": [ + { + "id": 2121, + "data": { + "commands": [ + { + "command": "git clone -q https://github.com/Izak88/d3-bundle.git -b 0.0.1 .", + "type": "git" + }, + { + "command": "git fetch origin 0.0.1", + "type": "git" + }, + { + "command": "git checkout 1f3e9ce9bae91202f7186644b7038405865b92bb .", + "type": "git" + }, + { + "command": "npm install", + "type": "install" + } + ], + "env": [ + "SCRIPT=test" + ], + "stage": "test", + "image": null, + "cache": null + }, + "builds_id": 500, + "created_at": 1507800338743, + "updated_at": 1507800338743, + "runs": [ + { + "id": 3351, + "start_time": 1507800338970, + "end_time": 1507800338929, + "status": "failed", + "log": "", + "job_id": 2121, + "build_run_id": 718, + "created_at": 1507800338816, + "updated_at": 1507800339056 + } + ], + "end_time": 1507800338929, + "start_time": 1507800338970, + "status": "failed" + } + ], + "runs": [ + { + "id": 718, + "head_id": 99934351, + "start_time": 1507800334520, + "end_time": null, + "build_id": 500, + "created_at": 1507800338403, + "updated_at": 1507800338403, + "job_runs": [ + { + "id": 3351, + "start_time": 1507800338970, + "end_time": 1507800338929, + "status": "failed", + "log": "", + "job_id": 2121, + "build_run_id": 718, + "created_at": 1507800338816, + "updated_at": 1507800339056 + } + ], + "status": "failed" + } + ], + "hasPermission": true + } +} diff --git a/tests/dev-scripts/data/push-d3-tag.json b/tests/dev-scripts/data/push-d3-tag.json new file mode 100644 index 000000000..01cdbaa71 --- /dev/null +++ b/tests/dev-scripts/data/push-d3-tag.json @@ -0,0 +1,156 @@ +{ + "ref": "refs/tags/0.0.1", + "before": "0000000000000000000000000000000000000000", + "after": "1f3e9ce9bae91202f7186644b7038405865b92bb", + "created": true, + "deleted": false, + "forced": false, + "base_ref": "refs/heads/master", + "compare": "https://github.com/Izak88/d3-bundle/compare/0.0.1", + "commits": [ + + ], + "head_commit": { + "id": "1f3e9ce9bae91202f7186644b7038405865b92bb", + "tree_id": "88ed9c20b1ac9e7438fef1348ae971c71b0cee74", + "distinct": true, + "message": "add jenkins file", + "timestamp": "2017-09-13T08:04:46+02:00", + "url": "https://github.com/Izak88/d3-bundle/commit/1f3e9ce9bae91202f7186644b7038405865b92bb", + "author": { + "name": "Izak Lipnik", + "email": "izak.lipnik@gmail.com", + "username": "Izak88" + }, + "committer": { + "name": "Izak Lipnik", + "email": "izak.lipnik@gmail.com", + "username": "Izak88" + }, + "added": [ + "jenkinsfile" + ], + "removed": [ + + ], + "modified": [ + + ] + }, + "repository": { + "id": 99934351, + "name": "d3-bundle", + "full_name": "Izak88/d3-bundle", + "owner": { + "name": "Izak88", + "email": "izak.lipnik@gmail.com", + "login": "Izak88", + "id": 8555269, + "avatar_url": "https://avatars0.githubusercontent.com/u/8555269?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Izak88", + "html_url": "https://github.com/Izak88", + "followers_url": "https://api.github.com/users/Izak88/followers", + "following_url": "https://api.github.com/users/Izak88/following{/other_user}", + "gists_url": "https://api.github.com/users/Izak88/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Izak88/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Izak88/subscriptions", + "organizations_url": "https://api.github.com/users/Izak88/orgs", + "repos_url": "https://api.github.com/users/Izak88/repos", + "events_url": "https://api.github.com/users/Izak88/events{/privacy}", + "received_events_url": "https://api.github.com/users/Izak88/received_events", + "type": "User", + "site_admin": false + }, + "private": false, + "html_url": "https://github.com/Izak88/d3-bundle", + "description": null, + "fork": true, + "url": "https://github.com/Izak88/d3-bundle", + "forks_url": "https://api.github.com/repos/Izak88/d3-bundle/forks", + "keys_url": "https://api.github.com/repos/Izak88/d3-bundle/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/Izak88/d3-bundle/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/Izak88/d3-bundle/teams", + "hooks_url": "https://api.github.com/repos/Izak88/d3-bundle/hooks", + "issue_events_url": "https://api.github.com/repos/Izak88/d3-bundle/issues/events{/number}", + "events_url": "https://api.github.com/repos/Izak88/d3-bundle/events", + "assignees_url": "https://api.github.com/repos/Izak88/d3-bundle/assignees{/user}", + "branches_url": "https://api.github.com/repos/Izak88/d3-bundle/branches{/branch}", + "tags_url": "https://api.github.com/repos/Izak88/d3-bundle/tags", + "blobs_url": "https://api.github.com/repos/Izak88/d3-bundle/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/Izak88/d3-bundle/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/Izak88/d3-bundle/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/Izak88/d3-bundle/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/Izak88/d3-bundle/statuses/{sha}", + "languages_url": "https://api.github.com/repos/Izak88/d3-bundle/languages", + "stargazers_url": "https://api.github.com/repos/Izak88/d3-bundle/stargazers", + "contributors_url": "https://api.github.com/repos/Izak88/d3-bundle/contributors", + "subscribers_url": "https://api.github.com/repos/Izak88/d3-bundle/subscribers", + "subscription_url": "https://api.github.com/repos/Izak88/d3-bundle/subscription", + "commits_url": "https://api.github.com/repos/Izak88/d3-bundle/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/Izak88/d3-bundle/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/Izak88/d3-bundle/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/Izak88/d3-bundle/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/Izak88/d3-bundle/contents/{+path}", + "compare_url": "https://api.github.com/repos/Izak88/d3-bundle/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/Izak88/d3-bundle/merges", + "archive_url": "https://api.github.com/repos/Izak88/d3-bundle/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/Izak88/d3-bundle/downloads", + "issues_url": "https://api.github.com/repos/Izak88/d3-bundle/issues{/number}", + "pulls_url": "https://api.github.com/repos/Izak88/d3-bundle/pulls{/number}", + "milestones_url": "https://api.github.com/repos/Izak88/d3-bundle/milestones{/number}", + "notifications_url": "https://api.github.com/repos/Izak88/d3-bundle/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/Izak88/d3-bundle/labels{/name}", + "releases_url": "https://api.github.com/repos/Izak88/d3-bundle/releases{/id}", + "deployments_url": "https://api.github.com/repos/Izak88/d3-bundle/deployments", + "created_at": 1502376699, + "updated_at": "2017-08-10T14:51:46Z", + "pushed_at": 1507800333, + "git_url": "git://github.com/Izak88/d3-bundle.git", + "ssh_url": "git@github.com:Izak88/d3-bundle.git", + "clone_url": "https://github.com/Izak88/d3-bundle.git", + "svn_url": "https://github.com/Izak88/d3-bundle", + "homepage": null, + "size": 34622, + "stargazers_count": 0, + "watchers_count": 0, + "language": "JavaScript", + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "open_issues_count": 0, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "stargazers": 0, + "master_branch": "master" + }, + "pusher": { + "name": "Izak88", + "email": "izak.lipnik@gmail.com" + }, + "sender": { + "login": "Izak88", + "id": 8555269, + "avatar_url": "https://avatars0.githubusercontent.com/u/8555269?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/Izak88", + "html_url": "https://github.com/Izak88", + "followers_url": "https://api.github.com/users/Izak88/followers", + "following_url": "https://api.github.com/users/Izak88/following{/other_user}", + "gists_url": "https://api.github.com/users/Izak88/gists{/gist_id}", + "starred_url": "https://api.github.com/users/Izak88/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Izak88/subscriptions", + "organizations_url": "https://api.github.com/users/Izak88/orgs", + "repos_url": "https://api.github.com/users/Izak88/repos", + "events_url": "https://api.github.com/users/Izak88/events{/privacy}", + "received_events_url": "https://api.github.com/users/Izak88/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/tests/dev-scripts/push-d3-tag.js b/tests/dev-scripts/push-d3-tag.js new file mode 100644 index 000000000..d83b09ec1 --- /dev/null +++ b/tests/dev-scripts/push-d3-tag.js @@ -0,0 +1,23 @@ +const request = require('request'); +const crypto = require('crypto'); +const data = require('./data/push-d3-tag.json'); +const headers = require('./data/push-request-headers.json'); + +const secret = 'thisIsSecret'; +const sig = crypto.createHmac('sha1', secret).update(JSON.stringify(data)).digest('hex'); +headers['X-Hub-Signature'] = `sha1=${sig}`; + +const options = { + url: 'http://localhost:6500/webhooks/github', + method: 'POST', + headers: headers, + json: data +}; + +request(options, (err, response, body) => { + if (err) { + console.error(err); + } else { + console.log('Done.'); + } +});