Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release From Beta #27

Merged
merged 6 commits into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 0 additions & 54 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,54 +0,0 @@
# [3.3.0](https://github.com/bradennapier/eslint-plus-action/compare/v3.2.0...v3.3.0) (2020-07-14)


### Bug Fixes

* bring readme template in workflow ([36f521f](https://github.com/bradennapier/eslint-plus-action/commit/36f521ff409c915b7b608158c7c7f13718b3e370))
* google replace ([3280301](https://github.com/bradennapier/eslint-plus-action/commit/32803018f4ae4d920a5161fc38b1ece81ee0649e))
* google replace version commit ([5c3e127](https://github.com/bradennapier/eslint-plus-action/commit/5c3e127c259c72e37dc4a96f5ebed022cef8bd13))
* merge conflict ([75e5353](https://github.com/bradennapier/eslint-plus-action/commit/75e5353e5cb4267aa16d97707d41ab556e6e8ea7))
* remove tag ([3e59afc](https://github.com/bradennapier/eslint-plus-action/commit/3e59afc57b037800c674ede2061cd3bde36488d2))


### Features

* add release notes generator ([518309f](https://github.com/bradennapier/eslint-plus-action/commit/518309fcc7632a768eb1cac5795189c8f306e62c))
* batched annotations ([#21](https://github.com/bradennapier/eslint-plus-action/issues/21)) ([e1e4b7e](https://github.com/bradennapier/eslint-plus-action/commit/e1e4b7e63adbcf34bd465ce09ef10c908ba573d5)), closes [/developer.github.com/v3/checks/runs/#output-object-1](https://github.com//developer.github.com/v3/checks/runs//issues/output-object-1)
* beta ([2b5e5aa](https://github.com/bradennapier/eslint-plus-action/commit/2b5e5aa749d17b7521fd63088c2626606ee3f8ad))
* gitignore README.md ([40f99fb](https://github.com/bradennapier/eslint-plus-action/commit/40f99fb173260b515fd077e26f72859af6a91b84))
* release changelog and package ([b81c9f1](https://github.com/bradennapier/eslint-plus-action/commit/b81c9f17702054ad52576204efb375bc7cd8e1f1))
* semantic-release ([#22](https://github.com/bradennapier/eslint-plus-action/issues/22)) ([d69fe57](https://github.com/bradennapier/eslint-plus-action/commit/d69fe5770de906bd30a325342dbfb0da02ed251a)), closes [/developer.github.com/v3/checks/runs/#output-object-1](https://github.com//developer.github.com/v3/checks/runs//issues/output-object-1)

# [3.3.0-beta.1](https://github.com/bradennapier/eslint-plus-action/compare/v3.2.0...v3.3.0-beta.1) (2020-07-14)


### Bug Fixes

* bring readme template in workflow ([36f521f](https://github.com/bradennapier/eslint-plus-action/commit/36f521ff409c915b7b608158c7c7f13718b3e370))
* google replace ([3280301](https://github.com/bradennapier/eslint-plus-action/commit/32803018f4ae4d920a5161fc38b1ece81ee0649e))
* google replace version commit ([5c3e127](https://github.com/bradennapier/eslint-plus-action/commit/5c3e127c259c72e37dc4a96f5ebed022cef8bd13))
* merge conflict ([75e5353](https://github.com/bradennapier/eslint-plus-action/commit/75e5353e5cb4267aa16d97707d41ab556e6e8ea7))
* remove tag ([3e59afc](https://github.com/bradennapier/eslint-plus-action/commit/3e59afc57b037800c674ede2061cd3bde36488d2))


### Features

* add release notes generator ([518309f](https://github.com/bradennapier/eslint-plus-action/commit/518309fcc7632a768eb1cac5795189c8f306e62c))
* batched annotations ([#21](https://github.com/bradennapier/eslint-plus-action/issues/21)) ([e1e4b7e](https://github.com/bradennapier/eslint-plus-action/commit/e1e4b7e63adbcf34bd465ce09ef10c908ba573d5)), closes [/developer.github.com/v3/checks/runs/#output-object-1](https://github.com//developer.github.com/v3/checks/runs//issues/output-object-1)
* beta ([2b5e5aa](https://github.com/bradennapier/eslint-plus-action/commit/2b5e5aa749d17b7521fd63088c2626606ee3f8ad))
* gitignore README.md ([40f99fb](https://github.com/bradennapier/eslint-plus-action/commit/40f99fb173260b515fd077e26f72859af6a91b84))
* release changelog and package ([b81c9f1](https://github.com/bradennapier/eslint-plus-action/commit/b81c9f17702054ad52576204efb375bc7cd8e1f1))
* semantic-release ([#22](https://github.com/bradennapier/eslint-plus-action/issues/22)) ([d69fe57](https://github.com/bradennapier/eslint-plus-action/commit/d69fe5770de906bd30a325342dbfb0da02ed251a)), closes [/developer.github.com/v3/checks/runs/#output-object-1](https://github.com//developer.github.com/v3/checks/runs//issues/output-object-1)

# [3.2.0-beta.3](https://github.com/bradennapier/eslint-plus-action/compare/v3.2.0-beta.2...v3.2.0-beta.3) (2020-07-14)


### Bug Fixes

* bring readme template in workflow ([36f521f](https://github.com/bradennapier/eslint-plus-action/commit/36f521ff409c915b7b608158c7c7f13718b3e370))


### Features

* add release notes generator ([518309f](https://github.com/bradennapier/eslint-plus-action/commit/518309fcc7632a768eb1cac5795189c8f306e62c))
* release changelog and package ([b81c9f1](https://github.com/bradennapier/eslint-plus-action/commit/b81c9f17702054ad52576204efb375bc7cd8e1f1))
194 changes: 0 additions & 194 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,194 +0,0 @@
<div align="center">
<br />
<br/>
<br/>
<p align="center">
<img src="docs/img/annotation.png" width="100%" title="eslint-plus-action">
</p>
<br />
<h1>
eslint-plus-action
</h1>
<br />
<br />
<br />
<br />
<sup>
A flexible and dead simple Github Action which runs ESLint against the changed files in a PR with customizable options and rich summaries. ESLint issues are annotated inline on your PR diff.
</sup>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>

## Dead Simple

As easy as the following, and even the more advanced features are just a few extra lines.

```yml
name: "my-workflow"
on: [pull_request]

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.3.0
```

## Features

- :tada: [**Works on Forked PR's Securely!**](https://github.com/bradennapier/eslint-plus-action#handle-forked-prs) :tada:
- [Inline Annotations of ESLint Warnings & Errors](https://github.com/bradennapier/eslint-plus-action/pull/3/files)
- Customizable ESLint options
- [Optional summary comments on each push to the PR](https://github.com/bradennapier/eslint-plus-action/pull/3)
- [Links to the rule documentation when available](https://github.com/bradennapier/eslint-plus-action/pull/3#issuecomment-646635983)
- [Annotation Summary Page](https://github.com/bradennapier/eslint-plus-action/pull/3/checks?check_run_id=788235048)
- Suggestions are printed when enabled (not yet provided as change suggestions)
- Button to run ESLint Fix [COMING SOON]
- More...

> The summary comments have some redundancy when there are suggestions available. This will be improved.

> The `fix` property is not yet setup but will come shortly. If fixes are available, it will render an action button to run the fix as well.

## Configuration

You provide configuration properties within your workflow by using the `with` property. See the `Simple Workflow Example` for an example of providing your github-token.

> `array` types are expected to be comma-separated values

### General Configuration Properties

| Property | Type | Default | Required | Description |
| ------------- | ---- | ------- | -------- | ----------- |
| github-token | string | secrets.GITHUB_TOKEN | false | Your Github token. You only need to provide this if you want to use something other than `secrets.GITHUB_TOKEN` |
| issueSummary | boolean | true | false | Should the bot provide a summary of the results as a comment? |
| 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? |
| 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 |
| ignoreGlob | array | none | false | Optional array of globs to ignore from the changed files list |
| configFile | string | none | false | A config file to use if the default config resolution doesn't work. |
| rulePaths | array | none | false | Optional paths to custom rules directories to include. |
| errorOnUnmatchedPattern | boolean | false | false | Throw error if unmatched pattern is seen? |
| useEslintrc | boolean | true | false | Use eslintrc? |
| useEslintIgnore | boolean | true | false | Use eslintignore? |
| fix | boolean | false | false | Commit fixes when possible (UNFINISHED) |
| npmInstall | boolean | false | false | Force run npm ci (or yarn) for you. If you do not use this option, be sure to install the project dependencies before running this action. By default it will run if a node_modules directory is not found or this is set to true |

> The official settings can always be seen by viewing the [`action.yml`](https://github.com/bradennapier/eslint-plus-action/blob/master/action.yml) schema for the action.

## Handle Forked PRs

GitHub Actions only have read permissions when a forked PR is opened. However, we can work around this by setting up a scheduled job in our workflow. This runs at your given interval and will automatically enable serialization of results as workflow artifacts when required. Since these will **always run against our master branch**, we can safely run our results without concern that the fork has modified the workflow in any way which may be malicious.

Each time the schedule job runs it will run through any new artifacts and update the PR with the results like normal. *If a job hasn't been detected in the last 24 hours then the action will no longer save artifacts.* This is so you do not needlessly use up your data storage.

> Note that we delete the artifacts as soon as they have been processed so they will
> not use up your storage for very long.

> You can optionally add additional optimization by also making sure to run this action
> on the `[closed]` event so that we can cleanup all the artifacts when this occurs.

<br />

> The scheduler will not start running until you have pushed the workflow to your main
> branch (`master`). If it still does not run you can try pushing an empty commit, it
> seems that is sometimes required `git commit --allow-empty -m 'redeploy schedule action'`

```yml
name: "lint"
on:
# by adding a schedule task to this workflow we will automatically
# begin serializing read-only runs and handling them. The cron job
# below is set to run every 15 minutes, GitHub will ignore anything
# under 10 minutes and run every 10 minutes anyway.
schedule:
- cron: '*/15 * * * *'
pull_request:
types:
- opened
- synchronize
- closed
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.3.0
```

## Examples

### Simple Workflow Example

Below is a basic example which should get you going. You can view the action.yml to see what other properties are available for customization.

```yml
name: "my-workflow"
on: [pull_request]

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.3.0
```

### Environment Variables

There may be times that you need to provide a `NPM_TOKEN` so that the action can install your private repos. You do this by adding the secret to your repo `Settings -> Secrets` then providing it as an environment variable to the action:

```yml
jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.3.0
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
```

### Providing Parameters

```yml
jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: bradennapier/eslint-plus-action@v3.3.0
env:
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
with:
issueSummaryType: full
reportIgnoredFiles: true
```

## More Previews

<p align="center">
<img src="docs/img/prcomment.png" width="100%" title="eslint-plus-action-pr-comment">
</p>

## Credits

This action was adapted from other actions which didn't quite work for me but were close. So special thanks to them for helping me get here.

- https://github.com/marketplace/actions/eslint-annotate
- https://github.com/marketplace/actions/eslint-action
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
"@typescript-eslint/eslint-plugin": "^3.6.1",
"@typescript-eslint/parser": "^3.6.1",
"@zeit/ncc": "^0.22.3",
"conventional-changelog-conventionalcommits": "^4.3.0",
"cz-conventional-changelog": "^3.2.0",
"eslint": "^7.4.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jest": "^23.18.0",
Expand Down
18 changes: 16 additions & 2 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
module.exports = {
plugins: [
[
'@semantic-release/commit-analyzer',
{
preset: 'conventionalcommits',
},
],
[
'@semantic-release/release-notes-generator',
{
preset: 'conventionalcommits',
},
],
'@semantic-release/changelog',
'@semantic-release/release-notes-generator',
[
'@google/semantic-release-replace-plugin',
{
Expand All @@ -19,7 +30,10 @@ module.exports = {
],
[
'@semantic-release/git',
{ assets: ['package.json', 'CHANGELOG.md', 'README.md'] },
{
assets: ['package.json', 'CHANGELOG.md', 'README.md'],
},
],
'@semantic-release/github',
],
};
Loading