Add support for detailled PageSpeed reports and gists plugin in terminal template
This commit is contained in:
2
action/dist/index.js
vendored
2
action/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -144,7 +144,7 @@
|
|||||||
//Handle errors
|
//Handle errors
|
||||||
catch (error) {
|
catch (error) {
|
||||||
if ((error.response?.status))
|
if ((error.response?.status))
|
||||||
throw {error:{message:`API returned ${error.response.status}`}, ...raw}
|
throw {error:{message:`API returned ${error.response.status}${error.response.data?.error_description ? ` (${error.response.data.error_description})` : ""}`}, ...raw}
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -7,9 +7,10 @@
|
|||||||
+ ((!!base.repositories)*(!!plugins.traffic))*18
|
+ ((!!base.repositories)*(!!plugins.traffic))*18
|
||||||
+ ((!!base.repositories)*(!!plugins.followup))*102
|
+ ((!!base.repositories)*(!!plugins.followup))*102
|
||||||
+ ((!!base.repositories)*(!!plugins.lines))*34
|
+ ((!!base.repositories)*(!!plugins.lines))*34
|
||||||
+ (!!plugins.pagespeed)*110
|
+ (!!plugins.pagespeed)*110 + (plugins.pagespeed?.detailed ?? 0)*6*16
|
||||||
+ (!!plugins.languages)*124
|
+ (!!plugins.languages)*124
|
||||||
+ Math.max(0, (((!!base.metadata)+(!!base.header)+((!!base.activity)||(!!base.community))+(!!base.repositories)+(!!plugins.pagespeed)+(!!plugins.languages))-1))*20
|
+ (!!plugins.gists)*58
|
||||||
|
+ Math.max(0, (((!!base.metadata)+(!!base.header)+((!!base.activity)||(!!base.community))+(!!base.repositories)+(!!plugins.pagespeed)+(!!plugins.languages)+(!!plugins.gists))-1))*20
|
||||||
%>">
|
%>">
|
||||||
<%
|
<%
|
||||||
meta.$ = `<span class="ps1-path">${`${user.login}`.toLocaleLowerCase()}@metrics</span>:<span class="ps1-location">~</span>${computed.token.scopes.includes("repo") ? "#" : "$"}`
|
meta.$ = `<span class="ps1-path">${`${user.login}`.toLocaleLowerCase()}@metrics</span>:<span class="ps1-location">~</span>${computed.token.scopes.includes("repo") ? "#" : "$"}`
|
||||||
@@ -107,7 +108,6 @@ Total <%= user.repositories.totalCount %> repositor<%= s(user.repositories.total
|
|||||||
-r-- <b><%= `${computed.repositories.forks}`.padStart(5) %></b> fork<%= s(computed.repositories.forks) %>
|
-r-- <b><%= `${computed.repositories.forks}`.padStart(5) %></b> fork<%= s(computed.repositories.forks) %>
|
||||||
-r-- <b><%= `${computed.repositories.watchers}`.padStart(5) %></b> watcher<%= s(computed.repositories.watchers) %>
|
-r-- <b><%= `${computed.repositories.watchers}`.padStart(5) %></b> watcher<%= s(computed.repositories.watchers) %>
|
||||||
dr-x <b><%= `${user.packages.totalCount}`.padStart(5) %></b> package<%= s(user.packages.totalCount) %>
|
dr-x <b><%= `${user.packages.totalCount}`.padStart(5) %></b> package<%= s(user.packages.totalCount) %>
|
||||||
dr-x <b><%= `${user.gists.totalCount}`.padStart(5) %></b> gist<%= s(user.gists.totalCount) %>
|
|
||||||
<% if (plugins.followup) { if (plugins.followup.error) { -%>
|
<% if (plugins.followup) { if (plugins.followup.error) { -%>
|
||||||
d--- <b> </b> ISSUES <span class="error">(<%= plugins.followup.error.message %>)</span>
|
d--- <b> </b> ISSUES <span class="error">(<%= plugins.followup.error.message %>)</span>
|
||||||
d--- <b> </b> PULL_REQUESTS <span class="error">(<%= plugins.followup.error.message %>)</span>
|
d--- <b> </b> PULL_REQUESTS <span class="error">(<%= plugins.followup.error.message %>)</span>
|
||||||
@@ -129,6 +129,14 @@ dr-x LICENSE
|
|||||||
<% }} -%>
|
<% }} -%>
|
||||||
</div><% } -%>
|
</div><% } -%>
|
||||||
<%# ============================================================= -%>
|
<%# ============================================================= -%>
|
||||||
|
<% if (plugins.gists) { %>
|
||||||
|
<div class="stdin"><%- meta.$ %> ls -lh github/gists</div><%# -%>
|
||||||
|
<div class="stdout"><%# -%>
|
||||||
|
Total <%= plugins.gists.totalCount %> gist<%= s(plugins.gists.totalCount) %>
|
||||||
|
-r-- <b><%= `${plugins.gists.stargazers}`.padStart(5) %></b> stargazer<%= s(plugins.gists.stargazers) %>
|
||||||
|
-r-- <b><%= `${plugins.gists.forks}`.padStart(5) %></b> fork<%= s(plugins.gists.forks) %>
|
||||||
|
</div><% } -%>
|
||||||
|
<%# ============================================================= -%>
|
||||||
<% if (plugins.languages) { %>
|
<% if (plugins.languages) { %>
|
||||||
<div class="stdin"><%- meta.$ %> locale</div><%# -%>
|
<div class="stdin"><%- meta.$ %> locale</div><%# -%>
|
||||||
<div class="stdout"><%# -%>
|
<div class="stdout"><%# -%>
|
||||||
@@ -140,7 +148,7 @@ dr-x LICENSE
|
|||||||
</div><% } -%>
|
</div><% } -%>
|
||||||
<%# ============================================================= -%>
|
<%# ============================================================= -%>
|
||||||
<% if (plugins.pagespeed) { %>
|
<% if (plugins.pagespeed) { %>
|
||||||
<div class="stdin"><%- meta.$ %> curl -I <%= user.websiteUrl %></div><%# -%>
|
<div class="stdin"><%- meta.$ %> curl -<%= plugins.pagespeed.detailed ? "v" : "" %>I <%= user.websiteUrl %></div><%# -%>
|
||||||
<div class="stdout"><%# -%>
|
<div class="stdout"><%# -%>
|
||||||
<% if (plugins.pagespeed.error) { -%>
|
<% if (plugins.pagespeed.error) { -%>
|
||||||
<span class="error"><%= plugins.pagespeed.error.message %></span><% } else { -%>
|
<span class="error"><%= plugins.pagespeed.error.message %></span><% } else { -%>
|
||||||
@@ -148,7 +156,17 @@ dr-x LICENSE
|
|||||||
<b>Location</b>: <%= user.websiteUrl %>
|
<b>Location</b>: <%= user.websiteUrl %>
|
||||||
<% for (const {score, title} of plugins.pagespeed.scores) { -%>
|
<% for (const {score, title} of plugins.pagespeed.scores) { -%>
|
||||||
<b><%= `X-${title.replace(/ /g, "-")}` %></b>: <%= !Number.isNaN(score) ? Math.round(score*100) : "-" %>%
|
<b><%= `X-${title.replace(/ /g, "-")}` %></b>: <%= !Number.isNaN(score) ? Math.round(score*100) : "-" %>%
|
||||||
<% }} -%>
|
<% } -%>
|
||||||
|
<% if (plugins.pagespeed.detailed) { for (const {name, score, suffix = "", threshold} of [
|
||||||
|
{name:"Time to interactive", score:plugins.pagespeed.metrics.interactive/1000, suffix:"s", threshold:[3.785, 7.3]},
|
||||||
|
{name:"Speed Index", score:plugins.pagespeed.metrics.speedIndex/1000, suffix:"s", threshold:[3.387, 5.8]},
|
||||||
|
{name:"Total Blocking Time", score:plugins.pagespeed.metrics.totalBlockingTime/1000, suffix:"s", threshold:[.287, .6]},
|
||||||
|
{name:"First Contentful Paint", score:plugins.pagespeed.metrics.firstContentfulPaint/1000, suffix:"s", threshold:[2.336, 4]},
|
||||||
|
{name:"Largest Contentful Paint", score:plugins.pagespeed.metrics.largestContentfulPaint/1000, suffix:"s", threshold:[2.5, 4]},
|
||||||
|
{name:"Cumulative Layout Shift", score:+plugins.pagespeed.metrics.cumulativeLayoutShift, threshold:[.1, .25]}
|
||||||
|
]) { -%>
|
||||||
|
<b>> <%= name %></b>: <%= !Number.isNaN(score) ? score : "-" %><%= suffix %> <% if (Number.isNaN(score)) { %><% } else if (score <= threshold[0]) { %>(ok +)<% } else if (score <= threshold[1]) { %>(ok)<% } else { %>(bad)<% } %>
|
||||||
|
<% }}} -%>
|
||||||
</div><% } -%>
|
</div><% } -%>
|
||||||
<%# ============================================================= -%>
|
<%# ============================================================= -%>
|
||||||
<% if (base.metadata) { -%>
|
<% if (base.metadata) { -%>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 9.8 KiB |
@@ -6,6 +6,8 @@ query Metrics {
|
|||||||
createdAt
|
createdAt
|
||||||
avatarUrl
|
avatarUrl
|
||||||
websiteUrl
|
websiteUrl
|
||||||
|
isHireable
|
||||||
|
twitterUsername
|
||||||
gists {
|
gists {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user