Skip to content
This repository was archived by the owner on Nov 18, 2024. It is now read-only.

Commit b3f0346

Browse files
authored
Merge pull request #40 from bradennapier/beta
Release Beta
2 parents a43e895 + f5bc573 commit b3f0346

File tree

10 files changed

+34
-53
lines changed

10 files changed

+34
-53
lines changed

CHANGELOG.md

-23
This file was deleted.

CONTRIBUTING.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Contributing
2+
3+
If you have changes that you wish to propose, we are open to PR's! Fork the repo and open your PR against the `beta` branch and we will review it once it has passed the linting checks.

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
runs-on: ubuntu-latest
4444
steps:
4545
- uses: actions/checkout@v2
46-
- uses: bradennapier/[email protected].0
46+
- uses: bradennapier/[email protected].1-beta.2
4747
```
4848
4949
## Features
@@ -77,9 +77,9 @@ You provide configuration properties within your workflow by using the `with` pr
7777
| issueSummaryType | string | compact | false | Changes the PR comment to be "full" (as shown on actions page) or "compact" |
7878
| issueSummaryMethod | string | edit | false | When issueSummary is enabled, allows having the bot edit or refresh the comment on each new push, can be 'edit' or 'refresh' |
7979
| issueSummaryOnlyOnEvent | boolean | false | false | Only provide the issue summary comment if there are warnings or errors present? |
80+
| annotateWarnings | boolean | true | false | By setting this to "false", only errors will be annotated |
8081
| reportSuggestions | boolean | true | false | Report suggestions when available within the annotations? |
8182
| reportIgnoredFiles | boolean | false | false | Report a list of any ignored files? |
82-
| reportWarnings | boolean | true | false | By setting this to "false", only errors will be annotated |
8383
| reportWarningsAsErrors | boolean | false | false | Report any eslint warnings as errors? |
8484
| extensions | array | .js,.jsx,.ts,.tsx | false | An array of extensions to lint |
8585
| includeGlob | array | \*\*/\* | false | Optional array of globs to include from the changed files list |
@@ -131,7 +131,7 @@ jobs:
131131
runs-on: ubuntu-latest
132132
steps:
133133
- uses: actions/checkout@v2
134-
- uses: bradennapier/[email protected].0
134+
- uses: bradennapier/[email protected].1-beta.2
135135
```
136136

137137
## Examples
@@ -149,7 +149,7 @@ jobs:
149149
runs-on: ubuntu-latest
150150
steps:
151151
- uses: actions/checkout@v2
152-
- uses: bradennapier/[email protected].0
152+
- uses: bradennapier/[email protected].1-beta.2
153153
```
154154

155155
### Environment Variables
@@ -162,7 +162,7 @@ jobs:
162162
runs-on: ubuntu-latest
163163
steps:
164164
- uses: actions/checkout@v2
165-
- uses: bradennapier/[email protected].0
165+
- uses: bradennapier/[email protected].1-beta.2
166166
env:
167167
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
168168
```
@@ -175,7 +175,7 @@ jobs:
175175
runs-on: ubuntu-latest
176176
steps:
177177
- uses: actions/checkout@v2
178-
- uses: bradennapier/[email protected].0
178+
- uses: bradennapier/[email protected].1-beta.2
179179
env:
180180
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
181181
with:

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: 'ESLint Plus'
22
description: 'Runs ESLint against changed files with customization, issue commenting, and more'
33
author: 'Braden R. Napier'
44
branding:
5-
icon: 'alert-triangle'
5+
icon: 'code'
66
color: 'red'
77
inputs:
88
github-token:

lib/utils/SerializerOctokitPlugin/plugin.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const artifacts_1 = require("../../artifacts");
99
const utils_1 = require("../../utils");
1010
const ARTIFACTS = new Set();
1111
exports.SerializerOctokitPlugin = (octokit, clientOptions) => {
12-
console.log('[SerializerOctokitPlugin] | Plugin Called: ', clientOptions);
1312
const { data } = clientOptions.serializer;
1413
const match = clientOptions.serializer.routes
1514
? routeMatcher_1.requestRouteMatcher(clientOptions.serializer.routes)
@@ -28,8 +27,7 @@ exports.SerializerOctokitPlugin = (octokit, clientOptions) => {
2827
if (!serializer) {
2928
throw new Error('[SerializerOctokitPlugin] | Attempted to serialize a path that is not handled');
3029
}
31-
data.state.rulesSummaries = [...data.state.rulesSummaries];
32-
const serializeResult = yield serializer.serialize(data, requestOptions);
30+
const serializeResult = yield serializer.serialize(Object.assign(Object.assign({}, data), { state: Object.assign(Object.assign({}, data.state), { rulesSummaries: Array.from(data.state.rulesSummaries) }) }), requestOptions);
3331
console.log('Serialize Result: ', JSON.stringify(serializeResult, null, 2));
3432
artifact.requests.add([requestOptions.url, serializeResult]);
3533
return serializeResult.result;
@@ -58,10 +56,10 @@ exports.SerializerOctokitPlugin = (octokit, clientOptions) => {
5856
if (!serializer) {
5957
throw new Error(`[SerializerOctokitPlugin] | Attempted to deserialize a path "${route}" which is not handled`);
6058
}
59+
data.state.rulesSummaries = new Map(data.state.rulesSummaries);
6160
yield serializer.deserialize(data, descriptor, octokit);
6261
yield issues_1.handleIssueComment(octokit, data);
6362
yield artifacts_1.updateIssueState(octokit, data);
64-
console.log('Success!');
6563
yield artifacts_1.deleteArtifactByName(octokit, utils_1.getIssueLintResultsName(data));
6664
}
6765
}

lib/utils/markdown.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@ function getRuleSummary(summary, data) {
4949
`;
5050
}
5151
function getSortedRuleSummaries(data) {
52-
if ([...data.state.rulesSummaries].length === 0) {
52+
const summaries = Array.from(data.state.rulesSummaries);
53+
if (summaries.length === 0) {
5354
return '';
5455
}
5556
return dedent_1.default `
5657
---
5758
58-
${[...data.state.rulesSummaries]
59+
${summaries
5960
.sort(([, a], [, b]) => a.level.localeCompare(b.level))
6061
.map(([, summary]) => getRuleSummary(summary, data))
6162
.join('\n\n---\n\n')}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "typescript-action",
3-
"version": "3.4.0",
3+
"version": "3.4.1-beta.2",
44
"private": true,
55
"description": "TypeScript template action",
66
"main": "lib/run.js",

release.config.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ module.exports = {
1212
preset: 'conventionalcommits',
1313
},
1414
],
15-
// creates CHANGELOG.md
16-
'@semantic-release/changelog',
1715
[
1816
'@google/semantic-release-replace-plugin',
1917
{
@@ -40,7 +38,7 @@ module.exports = {
4038
// commits the changed files to git
4139
'@semantic-release/git',
4240
{
43-
assets: ['package.json', 'CHANGELOG.md', 'README.md'],
41+
assets: ['package.json', 'README.md'],
4442
},
4543
],
4644
// creates the github release

src/utils/SerializerOctokitPlugin/plugin.ts

+14-11
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ export const SerializerOctokitPlugin = (
2222
clientOptions: Parameters<OctokitPlugin>[1],
2323
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2424
): { [key: string]: (...args: any[]) => any } => {
25-
console.log('[SerializerOctokitPlugin] | Plugin Called: ', clientOptions);
26-
2725
const { data }: { data: ActionData } = clientOptions.serializer;
2826

2927
const match = clientOptions.serializer.routes
@@ -69,14 +67,18 @@ export const SerializerOctokitPlugin = (
6967
);
7068
}
7169

72-
// TODO - should probably serialize a small amount of data and recapture
73-
// TODO - this data when needed on scheduler.
74-
// we need to convert these for them to be usable
75-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
76-
(data.state as any).rulesSummaries = [...data.state.rulesSummaries];
77-
7870
const serializeResult = await serializer.serialize(
79-
data,
71+
{
72+
...data,
73+
state: {
74+
...data.state,
75+
// TODO - should probably serialize a small amount of data and recapture
76+
// TODO - this data when needed on scheduler.
77+
// we need to convert these for them to be usable
78+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
79+
rulesSummaries: Array.from(data.state.rulesSummaries) as any,
80+
},
81+
},
8082
requestOptions,
8183
);
8284

@@ -139,12 +141,13 @@ export const SerializerOctokitPlugin = (
139141
);
140142
}
141143

144+
// this is converted with Array.from() before serializing, turn back into map
145+
data.state.rulesSummaries = new Map(data.state.rulesSummaries);
146+
142147
await serializer.deserialize(data, descriptor, octokit);
143148
await handleIssueComment(octokit, data);
144149
await updateIssueState(octokit, data);
145150

146-
console.log('Success!');
147-
148151
// the result artifact can now be removed
149152
await deleteArtifactByName(
150153
octokit,

src/utils/markdown.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,14 @@ function getRuleSummary(summary: LintRuleSummary, data: ActionData): string {
7575
}
7676

7777
export function getSortedRuleSummaries(data: ActionData): string {
78-
if ([...data.state.rulesSummaries].length === 0) {
78+
const summaries = Array.from(data.state.rulesSummaries);
79+
if (summaries.length === 0) {
7980
return '';
8081
}
8182
return dedent`
8283
---
8384
84-
${[...data.state.rulesSummaries]
85+
${summaries
8586
.sort(([, a], [, b]) => a.level.localeCompare(b.level))
8687
.map(([, summary]) => getRuleSummary(summary, data))
8788
.join('\n\n---\n\n')}

0 commit comments

Comments
 (0)