Skip to content

Commit 5170aa4

Browse files
committed
fix(): show correct data when new tag is pushed
1 parent 256dcbe commit 5170aa4

File tree

7 files changed

+465
-5
lines changed

7 files changed

+465
-5
lines changed

src/app/components/app-build-details/app-build-details.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,13 @@ export class AppBuildDetailsComponent implements OnInit, OnDestroy {
269269
this.dateTime = data.pull_request && data.pull_request.updated_at ||
270270
data.commit && data.commit.author && data.commit.author.date ||
271271
data.commits && data.commits[data.commits.length - 1] && data.commits[data.commits.length - 1].timestamp ||
272+
data.head_commit && data.head_commit.timestamp ||
272273
null;
273274

274275
if (this.build.repository.repository_provider === 'github') {
275276
if (this.build.data.commit) {
276277
this.commitMessage = this.build.data.commit.message;
277-
} else if (this.build.data.commits) {
278+
} else if (this.build.data.commits && this.build.data.commits.length > 0) {
278279
const len = this.build.data.commits.length - 1;
279280
this.commitMessage = this.build.data.commits[len].message;
280281
} else if (this.build.data.pull_request && this.build.data.pull_request.title) {

src/app/components/app-build-item/app-build-item.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<span *ngIf="name && !tag">{{ name }}</span>
4343
<span *ngIf="!build?.data?.user_name && !build?.data?.commits && build?.data?.actor?.display_name && !tag">{{ build?.data?.actor?.display_name }}</span>
4444
<span *ngIf="!build?.data?.user_name && !build?.data?.commits && !build?.data?.actor?.display_name && !build?.data?.sender?.login && build?.data?.user?.name && !tag">{{ build?.data?.user?.name }}</span>
45-
<span *ngIf="tag">{{ build?.data?.head_commit?.comitter?.name }}</span>
45+
<span *ngIf="tag">{{ build?.data?.head_commit?.committer?.name }}</span>
4646
<span *ngIf="build?.data?.user_name">{{ build?.data?.user_name }}</span>
4747
<span *ngIf="build?.data?.pusher">{{ build?.data?.pusher?.username }}</span>
4848
<span *ngIf="build?.data?.pull_request">{{ build?.data?.pull_request?.user?.username }}</span>
@@ -72,7 +72,7 @@
7272
<span class="name" *ngIf="name && !tag">{{ name }}</span>
7373
<span class="name" *ngIf="!build?.data?.user_name && !build?.data?.commits && build?.data?.actor?.display_name && !tag">{{ build?.data?.actor?.display_name }}</span>
7474
<span class="name" *ngIf="!build?.data?.user_name && !build?.data?.commits && !build?.data?.actor?.display_name && !build?.data?.sender?.login && build?.data?.user?.name && !tag">{{ build?.data?.user?.name }}</span>
75-
<span class="name" *ngIf="tag">{{ build?.data?.head_commit?.comitter?.name }}</span>
75+
<span class="name" *ngIf="tag">{{ build?.data?.head_commit?.committer?.name }}</span>
7676

7777
<span class="bold" *ngIf="build?.repository?.full_name">{{ build?.repository?.full_name }}</span>
7878
<span class="bold" *ngIf="!build?.repository?.full_name">{{ build?.data?.repository?.full_name }}</span>

src/app/components/app-build-item/app-build-item.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ export class AppBuildItemComponent implements OnInit {
6363
this.dateTime = data.pull_request && data.pull_request.updated_at ||
6464
data.commit && data.commit.author && data.commit.author.date ||
6565
data.commits && data.commits[data.commits.length - 1] && data.commits[data.commits.length - 1].timestamp ||
66+
data.head_commit && data.head_commit.timestamp ||
6667
null;
6768

6869
if (this.build.repository.repository_provider === 'github') {
6970
if (this.build.data.commit) {
7071
this.commitMessage = this.build.data.commit.message;
71-
} else if (this.build.data.commits) {
72+
} else if (this.build.data.commits && this.build.data.commits.length > 0) {
7273
const len = this.build.data.commits.length - 1;
7374
this.commitMessage = this.build.data.commits[len].message;
7475
} else if (this.build.data.pull_request && this.build.data.pull_request.title) {

src/app/components/app-job/app-job.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,12 +211,13 @@ export class AppJobComponent implements OnInit, OnDestroy {
211211
this.dateTime = data.pull_request && data.pull_request.updated_at ||
212212
data.commit && data.commit.author && data.commit.author.date ||
213213
data.commits && data.commits[data.commits.length - 1] && data.commits[data.commits.length - 1].timestamp ||
214+
data.head_commit && data.head_commit.timestamp ||
214215
null;
215216

216217
if (this.job.build.repository.repository_provider === 'github') {
217218
if (this.job.build.data.commit) {
218219
this.commitMessage = this.job.build.data.commit.message;
219-
} else if (this.job.build.data.commits) {
220+
} else if (this.job.build.data.commits && this.job.build.data.commits.length > 0) {
220221
const len = this.job.build.data.commits.length - 1;
221222
this.commitMessage = this.job.build.data.commits[len].message;
222223
} else if (this.job.build.data.pull_request && this.job.build.data.pull_request.title) {
Lines changed: 278 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
{
2+
"data": {
3+
"id": 500,
4+
"branch": "0.0.1",
5+
"pr": null,
6+
"head_id": null,
7+
"data": {
8+
"ref": "refs/tags/0.0.1",
9+
"before": "0000000000000000000000000000000000000000",
10+
"after": "1f3e9ce9bae91202f7186644b7038405865b92bb",
11+
"created": true,
12+
"deleted": false,
13+
"forced": false,
14+
"base_ref": "refs/heads/master",
15+
"compare": "https://github.com/Izak88/d3-bundle/compare/0.0.1",
16+
"commits": [],
17+
"head_commit": {
18+
"id": "1f3e9ce9bae91202f7186644b7038405865b92bb",
19+
"tree_id": "88ed9c20b1ac9e7438fef1348ae971c71b0cee74",
20+
"distinct": true,
21+
"message": "add jenkins file",
22+
"timestamp": "2017-09-13T08:04:46+02:00",
23+
"url": "https://github.com/Izak88/d3-bundle/commit/1f3e9ce9bae91202f7186644b7038405865b92bb",
24+
"author": {
25+
"name": "Izak Lipnik",
26+
"email": "izak.lipnik@gmail.com",
27+
"username": "Izak88"
28+
},
29+
"committer": {
30+
"name": "Izak Lipnik",
31+
"email": "izak.lipnik@gmail.com",
32+
"username": "Izak88"
33+
},
34+
"added": [
35+
"jenkinsfile"
36+
],
37+
"removed": [],
38+
"modified": []
39+
},
40+
"repository": {
41+
"id": 99934351,
42+
"name": "d3-bundle",
43+
"full_name": "Izak88/d3-bundle",
44+
"owner": {
45+
"name": "Izak88",
46+
"email": "izak.lipnik@gmail.com",
47+
"login": "Izak88",
48+
"id": 8555269,
49+
"avatar_url": "https://avatars0.githubusercontent.com/u/8555269?v=4",
50+
"gravatar_id": "",
51+
"url": "https://api.github.com/users/Izak88",
52+
"html_url": "https://github.com/Izak88",
53+
"followers_url": "https://api.github.com/users/Izak88/followers",
54+
"following_url": "https://api.github.com/users/Izak88/following{/other_user}",
55+
"gists_url": "https://api.github.com/users/Izak88/gists{/gist_id}",
56+
"starred_url": "https://api.github.com/users/Izak88/starred{/owner}{/repo}",
57+
"subscriptions_url": "https://api.github.com/users/Izak88/subscriptions",
58+
"organizations_url": "https://api.github.com/users/Izak88/orgs",
59+
"repos_url": "https://api.github.com/users/Izak88/repos",
60+
"events_url": "https://api.github.com/users/Izak88/events{/privacy}",
61+
"received_events_url": "https://api.github.com/users/Izak88/received_events",
62+
"type": "User",
63+
"site_admin": false
64+
},
65+
"private": false,
66+
"html_url": "https://github.com/Izak88/d3-bundle",
67+
"description": null,
68+
"fork": true,
69+
"url": "https://github.com/Izak88/d3-bundle",
70+
"forks_url": "https://api.github.com/repos/Izak88/d3-bundle/forks",
71+
"keys_url": "https://api.github.com/repos/Izak88/d3-bundle/keys{/key_id}",
72+
"collaborators_url": "https://api.github.com/repos/Izak88/d3-bundle/collaborators{/collaborator}",
73+
"teams_url": "https://api.github.com/repos/Izak88/d3-bundle/teams",
74+
"hooks_url": "https://api.github.com/repos/Izak88/d3-bundle/hooks",
75+
"issue_events_url": "https://api.github.com/repos/Izak88/d3-bundle/issues/events{/number}",
76+
"events_url": "https://api.github.com/repos/Izak88/d3-bundle/events",
77+
"assignees_url": "https://api.github.com/repos/Izak88/d3-bundle/assignees{/user}",
78+
"branches_url": "https://api.github.com/repos/Izak88/d3-bundle/branches{/branch}",
79+
"tags_url": "https://api.github.com/repos/Izak88/d3-bundle/tags",
80+
"blobs_url": "https://api.github.com/repos/Izak88/d3-bundle/git/blobs{/sha}",
81+
"git_tags_url": "https://api.github.com/repos/Izak88/d3-bundle/git/tags{/sha}",
82+
"git_refs_url": "https://api.github.com/repos/Izak88/d3-bundle/git/refs{/sha}",
83+
"trees_url": "https://api.github.com/repos/Izak88/d3-bundle/git/trees{/sha}",
84+
"statuses_url": "https://api.github.com/repos/Izak88/d3-bundle/statuses/{sha}",
85+
"languages_url": "https://api.github.com/repos/Izak88/d3-bundle/languages",
86+
"stargazers_url": "https://api.github.com/repos/Izak88/d3-bundle/stargazers",
87+
"contributors_url": "https://api.github.com/repos/Izak88/d3-bundle/contributors",
88+
"subscribers_url": "https://api.github.com/repos/Izak88/d3-bundle/subscribers",
89+
"subscription_url": "https://api.github.com/repos/Izak88/d3-bundle/subscription",
90+
"commits_url": "https://api.github.com/repos/Izak88/d3-bundle/commits{/sha}",
91+
"git_commits_url": "https://api.github.com/repos/Izak88/d3-bundle/git/commits{/sha}",
92+
"comments_url": "https://api.github.com/repos/Izak88/d3-bundle/comments{/number}",
93+
"issue_comment_url": "https://api.github.com/repos/Izak88/d3-bundle/issues/comments{/number}",
94+
"contents_url": "https://api.github.com/repos/Izak88/d3-bundle/contents/{+path}",
95+
"compare_url": "https://api.github.com/repos/Izak88/d3-bundle/compare/{base}...{head}",
96+
"merges_url": "https://api.github.com/repos/Izak88/d3-bundle/merges",
97+
"archive_url": "https://api.github.com/repos/Izak88/d3-bundle/{archive_format}{/ref}",
98+
"downloads_url": "https://api.github.com/repos/Izak88/d3-bundle/downloads",
99+
"issues_url": "https://api.github.com/repos/Izak88/d3-bundle/issues{/number}",
100+
"pulls_url": "https://api.github.com/repos/Izak88/d3-bundle/pulls{/number}",
101+
"milestones_url": "https://api.github.com/repos/Izak88/d3-bundle/milestones{/number}",
102+
"notifications_url": "https://api.github.com/repos/Izak88/d3-bundle/notifications{?since,all,participating}",
103+
"labels_url": "https://api.github.com/repos/Izak88/d3-bundle/labels{/name}",
104+
"releases_url": "https://api.github.com/repos/Izak88/d3-bundle/releases{/id}",
105+
"deployments_url": "https://api.github.com/repos/Izak88/d3-bundle/deployments",
106+
"created_at": 1502376699,
107+
"updated_at": "2017-08-10T14:51:46Z",
108+
"pushed_at": 1507800333,
109+
"git_url": "git://github.com/Izak88/d3-bundle.git",
110+
"ssh_url": "git@github.com:Izak88/d3-bundle.git",
111+
"clone_url": "https://github.com/Izak88/d3-bundle.git",
112+
"svn_url": "https://github.com/Izak88/d3-bundle",
113+
"homepage": null,
114+
"size": 34622,
115+
"stargazers_count": 0,
116+
"watchers_count": 0,
117+
"language": "JavaScript",
118+
"has_issues": false,
119+
"has_projects": true,
120+
"has_downloads": true,
121+
"has_wiki": true,
122+
"has_pages": false,
123+
"forks_count": 0,
124+
"mirror_url": null,
125+
"open_issues_count": 0,
126+
"forks": 0,
127+
"open_issues": 0,
128+
"watchers": 0,
129+
"default_branch": "master",
130+
"stargazers": 0,
131+
"master_branch": "master"
132+
},
133+
"pusher": {
134+
"name": "Izak88",
135+
"email": "izak.lipnik@gmail.com"
136+
},
137+
"sender": {
138+
"login": "Izak88",
139+
"id": 8555269,
140+
"avatar_url": "https://avatars0.githubusercontent.com/u/8555269?v=4",
141+
"gravatar_id": "",
142+
"url": "https://api.github.com/users/Izak88",
143+
"html_url": "https://github.com/Izak88",
144+
"followers_url": "https://api.github.com/users/Izak88/followers",
145+
"following_url": "https://api.github.com/users/Izak88/following{/other_user}",
146+
"gists_url": "https://api.github.com/users/Izak88/gists{/gist_id}",
147+
"starred_url": "https://api.github.com/users/Izak88/starred{/owner}{/repo}",
148+
"subscriptions_url": "https://api.github.com/users/Izak88/subscriptions",
149+
"organizations_url": "https://api.github.com/users/Izak88/orgs",
150+
"repos_url": "https://api.github.com/users/Izak88/repos",
151+
"events_url": "https://api.github.com/users/Izak88/events{/privacy}",
152+
"received_events_url": "https://api.github.com/users/Izak88/received_events",
153+
"type": "User",
154+
"site_admin": false
155+
}
156+
},
157+
"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}]",
158+
"start_time": 1507800334520,
159+
"end_time": 1507800338929,
160+
"repositories_id": 9,
161+
"created_at": 1507800338403,
162+
"updated_at": 1507800339106,
163+
"repository": {
164+
"id": 9,
165+
"github_id": 99934351,
166+
"bitbucket_id": null,
167+
"gitlab_id": null,
168+
"gogs_id": null,
169+
"clone_url": "https://github.com/Izak88/d3-bundle.git",
170+
"html_url": "https://github.com/Izak88/d3-bundle",
171+
"default_branch": "master",
172+
"name": "d3-bundle",
173+
"full_name": "Izak88/d3-bundle",
174+
"description": null,
175+
"private": 0,
176+
"fork": 1,
177+
"user_login": "Izak88",
178+
"user_id": "8555269",
179+
"user_avatar_url": "https://avatars0.githubusercontent.com/u/8555269?v=4",
180+
"user_url": "https://api.github.com/users/Izak88",
181+
"user_html_url": "https://github.com/Izak88",
182+
"access_tokens_id": null,
183+
"public": 1,
184+
"data": null,
185+
"created_at": 1507800334380,
186+
"updated_at": 1507800334380,
187+
"repository_provider": "github",
188+
"api_url": "https://api.github.com",
189+
"permissions": [
190+
{
191+
"id": 31,
192+
"repositories_id": 9,
193+
"users_id": 1,
194+
"permission": 1,
195+
"created_at": 1507800334417,
196+
"updated_at": 1507800334417
197+
}
198+
],
199+
"access_token": null
200+
},
201+
"jobs": [
202+
{
203+
"id": 2121,
204+
"data": {
205+
"commands": [
206+
{
207+
"command": "git clone -q https://github.com/Izak88/d3-bundle.git -b 0.0.1 .",
208+
"type": "git"
209+
},
210+
{
211+
"command": "git fetch origin 0.0.1",
212+
"type": "git"
213+
},
214+
{
215+
"command": "git checkout 1f3e9ce9bae91202f7186644b7038405865b92bb .",
216+
"type": "git"
217+
},
218+
{
219+
"command": "npm install",
220+
"type": "install"
221+
}
222+
],
223+
"env": [
224+
"SCRIPT=test"
225+
],
226+
"stage": "test",
227+
"image": null,
228+
"cache": null
229+
},
230+
"builds_id": 500,
231+
"created_at": 1507800338743,
232+
"updated_at": 1507800338743,
233+
"runs": [
234+
{
235+
"id": 3351,
236+
"start_time": 1507800338970,
237+
"end_time": 1507800338929,
238+
"status": "failed",
239+
"log": "",
240+
"job_id": 2121,
241+
"build_run_id": 718,
242+
"created_at": 1507800338816,
243+
"updated_at": 1507800339056
244+
}
245+
],
246+
"end_time": 1507800338929,
247+
"start_time": 1507800338970,
248+
"status": "failed"
249+
}
250+
],
251+
"runs": [
252+
{
253+
"id": 718,
254+
"head_id": 99934351,
255+
"start_time": 1507800334520,
256+
"end_time": null,
257+
"build_id": 500,
258+
"created_at": 1507800338403,
259+
"updated_at": 1507800338403,
260+
"job_runs": [
261+
{
262+
"id": 3351,
263+
"start_time": 1507800338970,
264+
"end_time": 1507800338929,
265+
"status": "failed",
266+
"log": "",
267+
"job_id": 2121,
268+
"build_run_id": 718,
269+
"created_at": 1507800338816,
270+
"updated_at": 1507800339056
271+
}
272+
],
273+
"status": "failed"
274+
}
275+
],
276+
"hasPermission": true
277+
}
278+
}

0 commit comments

Comments
 (0)