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

Commit

Permalink
Merge pull request #40 from bradennapier/beta
Browse files Browse the repository at this point in the history
Release Beta
  • Loading branch information
bradennapier authored Aug 12, 2020
2 parents a43e895 + f5bc573 commit b3f0346
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 53 deletions.
23 changes: 0 additions & 23 deletions CHANGELOG.md

This file was deleted.

3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contributing

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.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.4.0
- uses: bradennapier/eslint-plus-action@v3.4.1-beta.2
```
## Features
Expand Down Expand Up @@ -77,9 +77,9 @@ You provide configuration properties within your workflow by using the `with` pr
| issueSummaryType | string | compact | false | Changes the PR comment to be "full" (as shown on actions page) or "compact" |
| 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' |
| issueSummaryOnlyOnEvent | boolean | false | false | Only provide the issue summary comment if there are warnings or errors present? |
| annotateWarnings | boolean | true | false | By setting this to "false", only errors will be annotated |
| reportSuggestions | boolean | true | false | Report suggestions when available within the annotations? |
| reportIgnoredFiles | boolean | false | false | Report a list of any ignored files? |
| reportWarnings | boolean | true | false | By setting this to "false", only errors will be annotated |
| reportWarningsAsErrors | boolean | false | false | Report any eslint warnings as errors? |
| extensions | array | .js,.jsx,.ts,.tsx | false | An array of extensions to lint |
| includeGlob | array | \*\*/\* | false | Optional array of globs to include from the changed files list |
Expand Down Expand Up @@ -131,7 +131,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.4.0
- uses: bradennapier/eslint-plus-action@v3.4.1-beta.2
```

## Examples
Expand All @@ -149,7 +149,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.4.0
- uses: bradennapier/eslint-plus-action@v3.4.1-beta.2
```

### Environment Variables
Expand All @@ -162,7 +162,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.4.0
- uses: bradennapier/eslint-plus-action@v3.4.1-beta.2
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
```
Expand All @@ -175,7 +175,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.4.0
- uses: bradennapier/eslint-plus-action@v3.4.1-beta.2
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
with:
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: 'ESLint Plus'
description: 'Runs ESLint against changed files with customization, issue commenting, and more'
author: 'Braden R. Napier'
branding:
icon: 'alert-triangle'
icon: 'code'
color: 'red'
inputs:
github-token:
Expand Down
6 changes: 2 additions & 4 deletions lib/utils/SerializerOctokitPlugin/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const artifacts_1 = require("../../artifacts");
const utils_1 = require("../../utils");
const ARTIFACTS = new Set();
exports.SerializerOctokitPlugin = (octokit, clientOptions) => {
console.log('[SerializerOctokitPlugin] | Plugin Called: ', clientOptions);
const { data } = clientOptions.serializer;
const match = clientOptions.serializer.routes
? routeMatcher_1.requestRouteMatcher(clientOptions.serializer.routes)
Expand All @@ -28,8 +27,7 @@ exports.SerializerOctokitPlugin = (octokit, clientOptions) => {
if (!serializer) {
throw new Error('[SerializerOctokitPlugin] | Attempted to serialize a path that is not handled');
}
data.state.rulesSummaries = [...data.state.rulesSummaries];
const serializeResult = yield serializer.serialize(data, requestOptions);
const serializeResult = yield serializer.serialize(Object.assign(Object.assign({}, data), { state: Object.assign(Object.assign({}, data.state), { rulesSummaries: Array.from(data.state.rulesSummaries) }) }), requestOptions);
console.log('Serialize Result: ', JSON.stringify(serializeResult, null, 2));
artifact.requests.add([requestOptions.url, serializeResult]);
return serializeResult.result;
Expand Down Expand Up @@ -58,10 +56,10 @@ exports.SerializerOctokitPlugin = (octokit, clientOptions) => {
if (!serializer) {
throw new Error(`[SerializerOctokitPlugin] | Attempted to deserialize a path "${route}" which is not handled`);
}
data.state.rulesSummaries = new Map(data.state.rulesSummaries);
yield serializer.deserialize(data, descriptor, octokit);
yield issues_1.handleIssueComment(octokit, data);
yield artifacts_1.updateIssueState(octokit, data);
console.log('Success!');
yield artifacts_1.deleteArtifactByName(octokit, utils_1.getIssueLintResultsName(data));
}
}
Expand Down
5 changes: 3 additions & 2 deletions lib/utils/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ function getRuleSummary(summary, data) {
`;
}
function getSortedRuleSummaries(data) {
if ([...data.state.rulesSummaries].length === 0) {
const summaries = Array.from(data.state.rulesSummaries);
if (summaries.length === 0) {
return '';
}
return dedent_1.default `
---
${[...data.state.rulesSummaries]
${summaries
.sort(([, a], [, b]) => a.level.localeCompare(b.level))
.map(([, summary]) => getRuleSummary(summary, data))
.join('\n\n---\n\n')}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typescript-action",
"version": "3.4.0",
"version": "3.4.1-beta.2",
"private": true,
"description": "TypeScript template action",
"main": "lib/run.js",
Expand Down
4 changes: 1 addition & 3 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ module.exports = {
preset: 'conventionalcommits',
},
],
// creates CHANGELOG.md
'@semantic-release/changelog',
[
'@google/semantic-release-replace-plugin',
{
Expand All @@ -40,7 +38,7 @@ module.exports = {
// commits the changed files to git
'@semantic-release/git',
{
assets: ['package.json', 'CHANGELOG.md', 'README.md'],
assets: ['package.json', 'README.md'],
},
],
// creates the github release
Expand Down
25 changes: 14 additions & 11 deletions src/utils/SerializerOctokitPlugin/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export const SerializerOctokitPlugin = (
clientOptions: Parameters<OctokitPlugin>[1],
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): { [key: string]: (...args: any[]) => any } => {
console.log('[SerializerOctokitPlugin] | Plugin Called: ', clientOptions);

const { data }: { data: ActionData } = clientOptions.serializer;

const match = clientOptions.serializer.routes
Expand Down Expand Up @@ -69,14 +67,18 @@ export const SerializerOctokitPlugin = (
);
}

// TODO - should probably serialize a small amount of data and recapture
// TODO - this data when needed on scheduler.
// we need to convert these for them to be usable
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(data.state as any).rulesSummaries = [...data.state.rulesSummaries];

const serializeResult = await serializer.serialize(
data,
{
...data,
state: {
...data.state,
// TODO - should probably serialize a small amount of data and recapture
// TODO - this data when needed on scheduler.
// we need to convert these for them to be usable
// eslint-disable-next-line @typescript-eslint/no-explicit-any
rulesSummaries: Array.from(data.state.rulesSummaries) as any,
},
},
requestOptions,
);

Expand Down Expand Up @@ -139,12 +141,13 @@ export const SerializerOctokitPlugin = (
);
}

// this is converted with Array.from() before serializing, turn back into map
data.state.rulesSummaries = new Map(data.state.rulesSummaries);

await serializer.deserialize(data, descriptor, octokit);
await handleIssueComment(octokit, data);
await updateIssueState(octokit, data);

console.log('Success!');

// the result artifact can now be removed
await deleteArtifactByName(
octokit,
Expand Down
5 changes: 3 additions & 2 deletions src/utils/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ function getRuleSummary(summary: LintRuleSummary, data: ActionData): string {
}

export function getSortedRuleSummaries(data: ActionData): string {
if ([...data.state.rulesSummaries].length === 0) {
const summaries = Array.from(data.state.rulesSummaries);
if (summaries.length === 0) {
return '';
}
return dedent`
---
${[...data.state.rulesSummaries]
${summaries
.sort(([, a], [, b]) => a.level.localeCompare(b.level))
.map(([, summary]) => getRuleSummary(summary, data))
.join('\n\n---\n\n')}
Expand Down

0 comments on commit b3f0346

Please sign in to comment.