Introducing sort-by option (#1254)

* sort-issues-by introduced

* action.yml updated

* pushing the build code

* Update action.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update README.md for the new parameter (sort-issues-by)

* minor text format changes in README.md

* final draft of sort-issues-by

* Update src/interfaces/issues-processor-options.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/classes/issues-processor.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* refactored the code

* test

* test

* final changes

* update in README.md

* Documentation update

* updated sort-issues-by to sort-by

* minor changes

* dist fixes

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
suyashgaonkar
2025-07-11 09:00:19 +05:30
committed by GitHub
parent f78de9780e
commit 128b2c81d0
10 changed files with 67 additions and 0 deletions

30
dist/index.js vendored
View File

@@ -382,6 +382,7 @@ const statistics_1 = __nccwpck_require__(3334);
const logger_service_1 = __nccwpck_require__(1973);
const plugin_retry_1 = __nccwpck_require__(6298);
const rate_limit_1 = __nccwpck_require__(7069);
const get_sort_field_1 = __nccwpck_require__(9551);
/***
* Handle processing of issues for staleness/closure.
*/
@@ -684,6 +685,7 @@ class IssuesProcessor {
state: 'open',
per_page: 100,
direction: this.options.ascending ? 'asc' : 'desc',
sort: (0, get_sort_field_1.getSortField)(this.options.sortBy),
page
});
(_a = this.statistics) === null || _a === void 0 ? void 0 : _a.incrementFetchedItemsCount(issueResult.data.length);
@@ -2199,6 +2201,7 @@ var Option;
Option["RemovePrStaleWhenUpdated"] = "remove-pr-stale-when-updated";
Option["DebugOnly"] = "debug-only";
Option["Ascending"] = "ascending";
Option["SortBy"] = "sort-by";
Option["DeleteBranch"] = "delete-branch";
Option["StartDate"] = "start-date";
Option["ExemptMilestones"] = "exempt-milestones";
@@ -2333,6 +2336,25 @@ function isValidDate(date) {
exports.isValidDate = isValidDate;
/***/ }),
/***/ 9551:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getSortField = void 0;
function getSortField(sortOption) {
return sortOption === 'updated'
? 'updated'
: sortOption === 'comments'
? 'comments'
: 'created';
}
exports.getSortField = getSortField;
/***/ }),
/***/ 8236:
@@ -2542,6 +2564,7 @@ function _getAndValidateArgs() {
removePrStaleWhenUpdated: _toOptionalBoolean('remove-pr-stale-when-updated'),
debugOnly: core.getInput('debug-only') === 'true',
ascending: core.getInput('ascending') === 'true',
sortBy: _processParamtoString(core.getInput('sort-by')),
deleteBranch: core.getInput('delete-branch') === 'true',
startDate: core.getInput('start-date') !== ''
? core.getInput('start-date')
@@ -2628,6 +2651,13 @@ function _toOptionalBoolean(argumentName) {
}
return undefined;
}
function _processParamtoString(sortByValueInput) {
return sortByValueInput === 'updated'
? 'updated'
: sortByValueInput === 'comments'
? 'comments'
: 'created';
}
void _run();