Skip to content

Commit

Permalink
Merge pull request #5 from Krizzu/refactor/improvments1.1.0
Browse files Browse the repository at this point in the history
v1.1.0
  • Loading branch information
Krzysztof authored Mar 11, 2020
2 parents 61668e6 + 08ea0ae commit a10fa11
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 22 deletions.
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ COPY . /eslint_check_action

WORKDIR /eslint_check_action

ENTRYPOINT ["/eslint_check_action/start.sh"]

LABEL maintainer="Krzysztof Borowy <dev@krizzu.dev>"
LABEL com.github.actions.name="ESLint check action"
LABEL com.github.actions.description="Run Eslint checks in project"
LABEL com.github.actions.name="ESLint check"
LABEL com.github.actions.description="Runs ESlint check in your project and annotate errors/warning in a PR."
LABEL com.github.actions.icon="octagon"
LABEL com.github.actions.color="green"

RUN ["yarn", "install"]

RUN ["yarn", "build"]

ENTRYPOINT ["/eslint_check_action/start.sh"]
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,30 @@

GitHub action running eslint check in your project, annotating errors/warnings in PR.


## Features

- Customizable
- Installs project dependencies if missing
- Annotates lines in PR with warnings and errors

## Usage

Add workflow to your project (ex. `.github/workflows/eslint.yml`):

```yaml
name: Eslint check
name: Lint
on: [push]
jobs:
eslint_check:
name: prepare
name: Prepare action
runs-on: ubuntu-latest
steps:
# Checkout action must run prior to eslint check
- name: Checkout
uses: actions/checkout@v1
- name: Install dependencies
run: yarn install
- name: Lint
uses: Krizzu/eslint-check-action@v1.0.0
uses: Krizzu/eslint-check-action@v1.1.0
with:
ghToken: ${{ secrets.GITHUB_TOKEN }}
eslintFiles: "lib, scripts"
Expand All @@ -44,7 +49,7 @@ Default: `.eslintrc`

**eslintExt**

File extension to run linting on.
File extension to run linting on.
Default: `js, ts, jsx, tsx`

## License
Expand Down
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
name: 'Eslint check action'
name: 'Eslint check'
description: "GitHub action running eslint check in your project, annotating errors/warnings in PR."
author: "krizzu"
inputs:
ghToken:
description: 'GitHub token'
required: true
eslintFiles:
required: false
description: 'Relative path to files/directories to run lint on.'
default: '.'
eslintConfig:
required: false
description: 'Relative path to eslint config. Can either be ".js" config, ".eslintrc" or "package.json".'
default: '.eslintrc'
eslintExt:
required: false
description: 'File extension to run linting on.'
default: 'js, ts, jsx, tsx'
runs:
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"name": "@krizzu/eslint-check-action",
"version": "1.0.1",
"version": "1.1.0",
"description": "GitHub action running eslint check in your project, annotating errors/warnings in PR.",
"main": "dist/index.js",
"author": "Krzysztof Borowy <dev@krizzu.dev>",
"license": "MIT",
"scripts": {
"test": "tsc",
"dev": "source .env && yarn build && node dist/index.js",
"build": "rm -rf dist/ && babel src --out-dir dist/ --extensions .ts",
"prepublishOnly": "yarn build"
"build": "rm -rf dist/ && babel src --out-dir dist/ --extensions .ts"
},
"dependencies": {
"@actions/core": "1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/eslintRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import eslint from 'eslint';
import path from 'path';

class EslintRunner {
private name = 'Eslint check Action';
private name = 'Eslint Run';

private kit: GitHub;

Expand Down
14 changes: 7 additions & 7 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/sh

cd "/eslint_check_action"

yarn install
cd $GITHUB_WORKSPACE

main=./dist/index.js

if [ ! -f "$main" ]; then
yarn build
if [ ! -d "node_modules" ]; then
echo "Repo dependencies not installed. Installing..."
yarn install
fi

node "$main"
cd "/eslint_check_action" || exit

node "/eslint_check_action/dist/index.js"

0 comments on commit a10fa11

Please sign in to comment.