Skip to content

Commit

Permalink
Update @actions/github to 5.0.1 (#707)
Browse files Browse the repository at this point in the history
* Update github package

* Update dist

* Use @actions/github@5.0.1

* Cleanup

* More cleanup
  • Loading branch information
luketomlinson committed Mar 31, 2022
1 parent 74dfff0 commit a88f7b3
Show file tree
Hide file tree
Showing 14 changed files with 3,411 additions and 1,123 deletions.
2 changes: 1 addition & 1 deletion __tests__/any-of-labels.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ class IssuesProcessorBuilder {
issue.updated_at ?? new Date().toDateString(),
issue.created_at ?? new Date().toDateString(),
!!issue.pull_request,
issue.labels ? issue.labels.map(label => label.name) : []
issue.labels ? issue.labels.map(label => label.name || '') : []
)
);

Expand Down
2 changes: 1 addition & 1 deletion __tests__/exempt-draft-pr.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class IssuesProcessorBuilder {
issue.updated_at ?? new Date().toDateString(),
issue.created_at ?? new Date().toDateString(),
!!issue.pull_request,
issue.labels ? issue.labels.map(label => label.name) : []
issue.labels ? issue.labels.map(label => label.name || '') : []
)
);

Expand Down
2 changes: 1 addition & 1 deletion __tests__/only-labels.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ class IssuesProcessorBuilder {
issue.updated_at ?? new Date().toDateString(),
issue.created_at ?? new Date().toDateString(),
!!issue.pull_request,
issue.labels ? issue.labels.map(label => label.name) : []
issue.labels ? issue.labels.map(label => label.name || '') : []
)
);

Expand Down
2 changes: 1 addition & 1 deletion __tests__/remove-stale-when-updated.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ class IssuesProcessorBuilder {
issue.updated_at ?? new Date().toDateString(),
issue.created_at ?? new Date().toDateString(),
!!issue.pull_request,
issue.labels ? issue.labels.map(label => label.name) : []
issue.labels ? issue.labels.map(label => label.name || '') : []
)
);

Expand Down
4,264 changes: 3,258 additions & 1,006 deletions dist/index.js

Large diffs are not rendered by default.

165 changes: 97 additions & 68 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.6",
"@actions/github": "^4.0.0",
"@actions/github": "^5.0.1",
"lodash.deburr": "^4.1.0",
"semver": "^7.3.5"
},
Expand Down
21 changes: 16 additions & 5 deletions src/classes/issue.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {isLabeled} from '../functions/is-labeled';
import {isPullRequest} from '../functions/is-pull-request';
import {Assignee} from '../interfaces/assignee';
import {IIssue} from '../interfaces/issue';
import {IIssue, OctokitIssue} from '../interfaces/issue';
import {IIssuesProcessorOptions} from '../interfaces/issues-processor-options';
import {ILabel} from '../interfaces/label';
import {IMilestone} from '../interfaces/milestone';
Expand All @@ -17,27 +17,27 @@ export class Issue implements IIssue {
readonly pull_request: Object | null | undefined;
readonly state: string | 'closed' | 'open';
readonly locked: boolean;
readonly milestone: IMilestone | undefined;
readonly milestone?: IMilestone | null;
readonly assignees: Assignee[];
isStale: boolean;
operations = new Operations();
private readonly _options: IIssuesProcessorOptions;

constructor(
options: Readonly<IIssuesProcessorOptions>,
issue: Readonly<IIssue>
issue: Readonly<OctokitIssue> | Readonly<IIssue>
) {
this._options = options;
this.title = issue.title;
this.number = issue.number;
this.created_at = issue.created_at;
this.updated_at = issue.updated_at;
this.labels = issue.labels;
this.labels = mapLabels(issue.labels);
this.pull_request = issue.pull_request;
this.state = issue.state;
this.locked = issue.locked;
this.milestone = issue.milestone;
this.assignees = issue.assignees;
this.assignees = issue.assignees || [];
this.isStale = isLabeled(this, this.staleLabel);
}

Expand All @@ -59,3 +59,14 @@ export class Issue implements IIssue {
: this._options.staleIssueLabel;
}
}

function mapLabels(labels: (string | ILabel)[] | ILabel[]): ILabel[] {
return labels.map(label => {
if (typeof label == 'string') {
return {
name: label
};
}
return label;
});
}

0 comments on commit a88f7b3

Please sign in to comment.