diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6baa9a3..a1b444f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,10 +30,61 @@ jobs: - run: yarn lint-ci + - name: Save linting context for CodeCoach + run: echo "ESLINT_CONTEXT=$(pwd)" >> $GITHUB_ENV + + - name: Save eslint-report.json + uses: actions/upload-artifact@v3 + with: + name: eslint-report + path: eslint-report.json + retention-days: 1 + - run: yarn test --ci - run: yarn build + codecoach: + needs: npm-build + runs-on: ubuntu-latest + container: encx/codecoach-cli + + steps: + - uses: actions/checkout@v3 + + - name: Restore eslint-report.json + uses: actions/download-artifact@v3 + with: + name: eslint-report + path: . + + - name: CodeCoach + run: | + cat << EOF > codecoach.json + { + "vcs": "github", + "githubRepoUrl": "${{ github.server_url }}/${{ github.repository }}", + "githubPr": "${{ github.event.pull_request.number }}", + "githubToken": "${{ github.token }}", + "buildLogFile": [ + "eslint;eslint-report.json;${ESLINT_CONTEXT}" + ], + "removeOldComment": true, + "output": "output.json" + } + EOF + + codecoach --config="codecoach.json" + + - name: Save CodeCoach debug info + uses: actions/upload-artifact@v3 + with: + name: codecoach-debug + path: | + eslint-report.json + output.json + debug.log + docker-build: name: "docker: Build" runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 84a2a14..f9cbe88 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ dist/ node_modules/ *.log +eslint-report.json # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 diff --git a/package.json b/package.json index 213c550..9cebc2f 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "license": "MIT", "scripts": { "lint": "eslint 'src/**/*.{js,ts}' --quiet --fix", - "lint-ci": "eslint 'src/**/*.{js,ts}'", + "lint-ci": "eslint 'src/**/*.{js,ts}' -f json -o eslint-report.json || true", "format": "prettier --write 'src/**/*.{js,ts}'", "test": "jest", "build": "tsc --project tsconfig.build.json", diff --git a/src/app.ts b/src/app.ts index ed6f7f3..fa55731 100644 --- a/src/app.ts +++ b/src/app.ts @@ -51,7 +51,7 @@ class App { configs.githubPr, ); return new GitHubAdapter(githubPRService); - } else if (configs.vcs === 'gitlab') { + } else if (configs.vcs == "gitlab") { return new GitLabAdapter(new GitLabMRService()); } } @@ -63,7 +63,7 @@ class App { case ProjectType.msbuild: return new MSBuildParser(cwd); case ProjectType.tslint: - return new TSLintParser(cwd); + return new TSLintParser(cwd) case ProjectType.eslint: return new ESLintParser(cwd); case ProjectType.scalastyle: