Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Github Action to review code changes on a Pull-Request and add corresponding review comments with eslint issues, test coverage and vulnerabilities for a clean code promotion.

Notifications You must be signed in to change notification settings

tamdilip/eslint-review-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

217 Commits

Repository files navigation

Github Action to review code changes on a Pull-Request and add corresponding review comments for a clean Merge process.

This action repo mainly targets on Ember app, does eslint on only changed set of files in a pull-request and cosecutive commits. Also does ember testing along with code coverage for entire app, if ember-cli-code-coverage setup is configured. Together runs npm audit check to get the vulnerability report.

πŸ•Ή Usage:

Add the following to your workflow .yml file in app (secrets.GITHUB_TOKEN is the default Personal Access Token(PAT) generated):

name: Run eslint review action repo
uses: tamdilip/eslint-review-action@v1
with:
 repo-token: ${{ secrets.GITHUB_TOKEN }}

Incase of consuming this action by moving to private repo (secrets.ACTION_TOKEN should be a new private token to clone action):

name: Checkout GitHub Action Repo
uses: actions/checkout@v2
with:
 repository: tamdilip/eslint-review-action
 ref: v1
 token: ${{ secrets.ACTION_TOKEN }}
 path: .github/actions/eslint-review-action
name: Run eslint-review-action action
uses: ./.github/actions/eslint-review-action
with:
 repo-token: ${{ secrets.ACTION_TOKEN }}

Complete working sample .github/workflow/action.yml:

name: Pull request review
on:
 pull_request:
 branches: [ master ]
jobs:
 eslint:
 name: ESLINT REVIEW ACTION
 runs-on: ubuntu-latest
 steps:
 - name: Checkout Repo
 uses: actions/checkout@v2
 - name: Install Dependencies
 uses: actions/setup-node@v1
 with:
 node-version: 12.x
 - name: Cache node modules
 uses: actions/cache@v2
 with:
 path: |
 **/node_modules
 key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
 - run: npm install
 - name: Checkout GitHub Action Repo
 uses: tamdilip/eslint-review-action@v1
 with:
 repo-token: ${{ secrets.GITHUB_TOKEN }}

Dynamic inputs and configurations ( add under with:)

Most of the action items can be configured dynamically as per the need with all these available set of config inputs here - action.yml.

All available inputs

 repo-token:
 description: 'Token used to interact with the Github API.'
 required: true
 bot-user-name:
 description: 'Set username of the token provide to filter out comments'
 required: false
 default: ''
 disable-eslint:
 description: 'Set true to stop linting.'
 required: false
 default: 'false'
 disable-ember-test:
 description: 'Set true to stop ember testing.'
 required: false
 default: 'false'
 disable-npm-audit:
 description: 'Set true to stop npm auditing.'
 required: false
 default: 'false'
 fail-on-test:
 description: 'Set true to fail the pull-request merge status, if ember test has failing test cases.'
 required: false
 default: 'false'
 disable-test-coverage:
 description: 'Set true to stop ember coverage execution, when ember test is enabled.'
 required: false
 default: 'false'
 test-coverage-threshold:
 description: 'Minimum test coverage percentage to pass the pull-request.'
 required: false
 default: '0'
 vulnerability-fail-on:
 description: 'Set vulnerability criteria to fail the pull-request merge status, OPTIONS: INFO/LOW/MODERATE/HIGH/CRITICAL'
 required: false
 default: ''
 pass-emoji:
 description: 'Emoji to indicate fixed eslint issue.'
 required: false
 default: 'βœ”οΈ'
 fail-emoji:
 description: 'Emoji to indicate failed eslint issue.'
 required: false
 default: '❌'
 info-emoji:
 description: 'Emoji to indicate status message.'
 required: false
 default: 'πŸ“’'
 eslint-emoji:
 description: 'Emoji for eslint header label.'
 required: false
 default: 'πŸ› '
 test-emoji:
 description: 'Emoji for test header label.'
 required: false
 default: 'πŸ”¬'
 vulnerability-emoji:
 description: 'Emoji for vulnerability header label.'
 required: false
 default: 'πŸ‘½'
 eslint-report-header:
 description: 'Header text for Eslint issues.'
 required: false
 default: 'ESLINT ISSUES'
 test-report-header:
 description: 'Header text for Test case report.'
 required: false
 default: 'TEST CASE REPORT'
 vulnerability-report-header:
 description: 'Header text for node dependencies vulnerability report.'
 required: false
 default: 'VULNERABILITY REPORT'
 eslint-common-issues-disclaimer:
 description: 'Disclaimer text to explain about the common grouped set of eslint issue comment.'
 required: false
 default: 'issues listed below are in areas other than visible changed portion of lines'

Actions Output Visuals

πŸ’¬ Inline comment

For eslint issues occurred at actual changed portion of lines part of the pull-request and the visible diff section as below -

Inline Comment

πŸ’¬ Grouped common issue comment

For eslint issues occurred at other than changed portion of lines part of the pull-request and not at the visible diff section, along with test coverage and vulnerability report as below -

Grouped common issue comment

πŸ’¬ Pull request action run status

Incase of any issues, the pull-request merge status will be displayed as below from the action run -

Pull request action run status

Local setup and development

$ git clone https://github.com/tamdilip/eslint-review-action.git
$ cd eslint-review-action
$ npm install
$ ncc build index.js

References

Happy coding :) !!

About

Github Action to review code changes on a Pull-Request and add corresponding review comments with eslint issues, test coverage and vulnerabilities for a clean code promotion.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /