Skip to content

Commit

Permalink
chore(assignees): add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
C0ZEN committed Sep 14, 2021
1 parent 002bc97 commit 4b8d33c
Show file tree
Hide file tree
Showing 10 changed files with 1,010 additions and 952 deletions.
21 changes: 10 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# Changelog

Starting in version 4.0.0 we will maintain a changelog

## [4.0.0](https://github.com/actions/stale/compare/v3.0.19...v4.0.0) (2021-07-14)


### Features

* **options:** simplify config by removing skip stale message options ([#457](https://github.com/actions/stale/issues/457)) ([6ec637d](https://github.com/actions/stale/commit/6ec637d238067ab8cc96c9289dcdac280bbd3f4a)), closes [#405](https://github.com/actions/stale/issues/405) [#455](https://github.com/actions/stale/issues/455)
* **output:** print output parameters ([#458](https://github.com/actions/stale/issues/458)) ([3e6d35b](https://github.com/actions/stale/commit/3e6d35b685f0b2fa1a69be893fa07d3d85e05ee0))

- **options:** simplify config by removing skip stale message options ([#457](https://github.com/actions/stale/issues/457)) ([6ec637d](https://github.com/actions/stale/commit/6ec637d238067ab8cc96c9289dcdac280bbd3f4a)), closes [#405](https://github.com/actions/stale/issues/405) [#455](https://github.com/actions/stale/issues/455)
- **output:** print output parameters ([#458](https://github.com/actions/stale/issues/458)) ([3e6d35b](https://github.com/actions/stale/commit/3e6d35b685f0b2fa1a69be893fa07d3d85e05ee0))

### Bug Fixes

* **dry-run:** forbid mutations in dry-run ([#500](https://github.com/actions/stale/issues/500)) ([f1017f3](https://github.com/actions/stale/commit/f1017f33dd159ea51366375120c3e6981d7c3097)), closes [#499](https://github.com/actions/stale/issues/499)
* **logs:** coloured logs ([#465](https://github.com/actions/stale/issues/465)) ([5fbbfba](https://github.com/actions/stale/commit/5fbbfba142860ea6512549e96e36e3540c314132))
* **operations:** fail fast the current batch to respect the operations limit ([#474](https://github.com/actions/stale/issues/474)) ([5f6f311](https://github.com/actions/stale/commit/5f6f311ca6aa75babadfc7bac6edf5d85fa3f35d)), closes [#466](https://github.com/actions/stale/issues/466)
* **label comparison**: make label comparison case insensitive [#517](https://github.com/actions/stale/pull/517), closes [#516](https://github.com/actions/stale/pull/516)
* **filtering comments by actor could have strange behavior**: "stale" comments are now detected based on if the message is the stale message not _who_ made the comment([#519](https://github.com/actions/stale/pull/519)), fixes [#441](https://github.com/actions/stale/pull/441), [#509](https://github.com/actions/stale/pull/509), [#518](https://github.com/actions/stale/pull/518)
- **dry-run:** forbid mutations in dry-run ([#500](https://github.com/actions/stale/issues/500)) ([f1017f3](https://github.com/actions/stale/commit/f1017f33dd159ea51366375120c3e6981d7c3097)), closes [#499](https://github.com/actions/stale/issues/499)
- **logs:** coloured logs ([#465](https://github.com/actions/stale/issues/465)) ([5fbbfba](https://github.com/actions/stale/commit/5fbbfba142860ea6512549e96e36e3540c314132))
- **operations:** fail fast the current batch to respect the operations limit ([#474](https://github.com/actions/stale/issues/474)) ([5f6f311](https://github.com/actions/stale/commit/5f6f311ca6aa75babadfc7bac6edf5d85fa3f35d)), closes [#466](https://github.com/actions/stale/issues/466)
- **label comparison**: make label comparison case insensitive [#517](https://github.com/actions/stale/pull/517), closes [#516](https://github.com/actions/stale/pull/516)
- **filtering comments by actor could have strange behavior**: "stale" comments are now detected based on if the message is the stale message not _who_ made the comment([#519](https://github.com/actions/stale/pull/519)), fixes [#441](https://github.com/actions/stale/pull/441), [#509](https://github.com/actions/stale/pull/509), [#518](https://github.com/actions/stale/pull/518)

### Breaking Changes

* The options `skip-stale-issue-message` and `skip-stale-pr-message` were removed. Instead, setting the options `stale-issue-message` and `stale-pr-message` will be enough to let the stale workflow add a comment. If the options are unset, a comment will not be added which was the equivalent of setting `skip-stale-issue-message` to `true`.
* The `operations-per-run` option will be more effective. After migrating, you could face a failed-fast process workflow if you let the default value (30) or set it to a small number. In that case, you will see a warning at the end of the logs (if enabled) indicating that the workflow was stopped sooner to avoid consuming too much API calls. In most cases, you can just increase this limit to make sure to process everything in a single run.
- The options `skip-stale-issue-message` and `skip-stale-pr-message` were removed. Instead, setting the options `stale-issue-message` and `stale-pr-message` will be enough to let the stale workflow add a comment. If the options are unset, a comment will not be added which was the equivalent of setting `skip-stale-issue-message` to `true`.
- The `operations-per-run` option will be more effective. After migrating, you could face a failed-fast process workflow if you let the default value (30) or set it to a small number. In that case, you will see a warning at the end of the logs (if enabled) indicating that the workflow was stopped sooner to avoid consuming too much API calls. In most cases, you can just increase this limit to make sure to process everything in a single run.
7 changes: 4 additions & 3 deletions __tests__/functions/generate-issue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Issue} from '../../src/classes/issue';
import {IAssignee} from '../../src/interfaces/assignee';
import {IUserAssignee} from '../../src/interfaces/assignee';
import {IIssuesProcessorOptions} from '../../src/interfaces/issues-processor-options';
import {IsoDateString} from '../../src/types/iso-date-string';

Expand Down Expand Up @@ -32,9 +32,10 @@ export function generateIssue(
title: milestone
}
: undefined,
assignees: assignees.map((assignee: Readonly<string>): IAssignee => {
assignees: assignees.map((assignee: Readonly<string>): IUserAssignee => {
return {
login: assignee
login: assignee,
type: 'User'
};
})
});
Expand Down
19 changes: 14 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ exports.Issue = void 0;
const is_labeled_1 = __nccwpck_require__(6792);
const is_pull_request_1 = __nccwpck_require__(5400);
const operations_1 = __nccwpck_require__(7957);
const logger_1 = __nccwpck_require__(6212);
class Issue {
constructor(options, issue) {
this.operations = new operations_1.Operations();
Expand All @@ -167,6 +168,10 @@ class Issue {
this.locked = issue.locked;
this.milestone = issue.milestone;
this.assignees = issue.assignees;
// @todo remove this log
const logger = new logger_1.Logger();
logger.info('Assignees:');
logger.info(...this.assignees.map((assignee) => JSON.stringify(assignee)));
this.isStale = is_labeled_1.isLabeled(this, this.staleLabel);
}
get isPullRequest() {
Expand Down Expand Up @@ -248,12 +253,12 @@ const logger_service_1 = __nccwpck_require__(1973);
*/
class IssuesProcessor {
constructor(options) {
this._logger = new logger_1.Logger();
this.staleIssues = [];
this.closedIssues = [];
this.deletedBranchIssues = [];
this.removedLabelIssues = [];
this.addedLabelIssues = [];
this._logger = new logger_1.Logger();
this.options = options;
this.client = github_1.getOctokit(this.options.repoToken);
this.operations = new stale_operations_1.StaleOperations(this.options);
Expand Down Expand Up @@ -744,7 +749,11 @@ class IssuesProcessor {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const issueLogger = new issue_logger_1.IssueLogger(issue);
issueLogger.info(`Delete branch from closed $$type - ${issue.title}`);
issueLogger.info(`Delete
branch from closed $
$type
-
${issue.title}`);
const pullRequest = yield this._getPullRequest(issue);
if (!pullRequest) {
issueLogger.info(`Not deleting this branch as no pull request was found for this $$type`);
Expand Down Expand Up @@ -8993,12 +9002,12 @@ module.exports = require("zlib");;
/******/ /* webpack/runtime/compat */
/******/
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/
/******/
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
/******/ var __webpack_exports__ = __nccwpck_require__(3109);
/******/ module.exports = __webpack_exports__;
/******/
/******/
/******/ })()
;
;

0 comments on commit 4b8d33c

Please sign in to comment.