Implement boosted robogrades #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linter | |
on: pull_request | |
jobs: | |
ESLint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '16.x' | |
- name: Run checks | |
run: | | |
URL="https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" | |
PR_FILES=$(curl -s -X GET -G $URL | jq -r '.[] | select(.status != "removed") | .filename') | |
for files in $PR_FILES; do | |
extension="${files##*.}" | |
if [[ $extension == 'js' || $extension == 'ts' || $extension == 'jsx' || $extension == 'tsx' ]]; then | |
changed_files_eslint+=" ${files}" | |
fi | |
done | |
if [[ ! -z ${changed_files_eslint} ]]; then | |
npm ci | |
cd tests && npm ci && cd .. | |
npm install eslint-detailed-reporter --save-dev --legacy-peer-deps | |
mkdir -p eslint_report | |
echo "ESLint version: "`npx eslint --version` | |
echo "The files will be checked: "`echo ${changed_files_eslint}` | |
npx eslint ${changed_files_eslint} -f node_modules/eslint-detailed-reporter/lib/detailed.js -o ./eslint_report/eslint_checks.html | |
else | |
echo "No files with the \"js|ts|jsx|tsx\" extension found" | |
fi | |
- name: Upload artifacts | |
if: failure() | |
uses: actions/upload-artifact@v2 | |
with: | |
name: eslint_report | |
path: eslint_report |