File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -31518,6 +31518,7 @@ var userAgent = core.getInput("user_agent");
31518
31518
var acceptHeader = core.getInput("accept_header");
31519
31519
var TOTAL_POST_COUNT = Number.parseInt(core.getInput("max_post_count"));
31520
31520
var ENABLE_SORT = core.getInput("disable_sort") === "false";
31521
+ var SORT_ORDER = core.getInput("sort_order");
31521
31522
var ENABLE_VALIDATION = core.getInput("disable_item_validation") === "false";
31522
31523
var TITLE_MAX_LENGTH = core.getInput("title_max_length") ? Number.parseInt(core.getInput("title_max_length")) : null;
31523
31524
var DESCRIPTION_MAX_LENGTH = core.getInput("description_max_length") ? Number.parseInt(core.getInput("description_max_length")) : null;
@@ -31682,7 +31683,16 @@ var runWorkflow = async () => {
31682
31683
postsArray = postsArray.filter((item2) => item2 !== null);
31683
31684
if (ENABLE_SORT) {
31684
31685
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
+ }
31686
31696
});
31687
31697
}
31688
31698
postsArray = postsArray.slice(0, TOTAL_POST_COUNT);
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " blog-post-workflow" ,
3
- "version" : " 1.9.1 " ,
3
+ "version" : " 1.9.2 " ,
4
4
"description" : " Allows you to show your latest blog posts on your github profile or project readme" ,
5
5
"main" : " blog-post-workflow.js" ,
6
6
"scripts" : {
You can’t perform that action at this time.
0 commit comments