Skip to content

Commit 0ef2f05

Browse files
committed
[skip-ci] Published 1.9.2
1 parent 9f13c43 commit 0ef2f05

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

dist/blog-post-workflow.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31518,6 +31518,7 @@ var userAgent = core.getInput("user_agent");
3151831518
var acceptHeader = core.getInput("accept_header");
3151931519
var TOTAL_POST_COUNT = Number.parseInt(core.getInput("max_post_count"));
3152031520
var ENABLE_SORT = core.getInput("disable_sort") === "false";
31521+
var SORT_ORDER = core.getInput("sort_order");
3152131522
var ENABLE_VALIDATION = core.getInput("disable_item_validation") === "false";
3152231523
var TITLE_MAX_LENGTH = core.getInput("title_max_length") ? Number.parseInt(core.getInput("title_max_length")) : null;
3152331524
var DESCRIPTION_MAX_LENGTH = core.getInput("description_max_length") ? Number.parseInt(core.getInput("description_max_length")) : null;
@@ -31682,7 +31683,16 @@ var runWorkflow = async () => {
3168231683
postsArray = postsArray.filter((item2) => item2 !== null);
3168331684
if (ENABLE_SORT) {
3168431685
postsArray.sort(function(a, b) {
31685-
return b.date - a.date;
31686+
const aHasDate = !!a.date;
31687+
const bHasDate = !!b.date;
31688+
if (!aHasDate && !bHasDate) return 0;
31689+
if (!aHasDate) return 1;
31690+
if (!bHasDate) return -1;
31691+
if (SORT_ORDER === "asc") {
31692+
return a.date - b.date;
31693+
} else {
31694+
return b.date - a.date;
31695+
}
3168631696
});
3168731697
}
3168831698
postsArray = postsArray.slice(0, TOTAL_POST_COUNT);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blog-post-workflow",
3-
"version": "1.9.1",
3+
"version": "1.9.2",
44
"description": "Allows you to show your latest blog posts on your github profile or project readme",
55
"main": "blog-post-workflow.js",
66
"scripts": {

0 commit comments

Comments
 (0)