update linting ci

This commit is contained in:
mrjvs 2023-03-10 19:10:08 +01:00
parent bdb4b3507a
commit 6b9774a210
2 changed files with 56 additions and 9 deletions

49
.github/workflows/linting_annotate.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: Annotate linting
permissions:
actions: read # download artifact
checks: write # annotate
# this is done as a seperate workflow so
# the annotater has access to write to checks (to annotate)
on:
workflow_run:
workflows: ["Linting and Testing"]
types:
- completed
jobs:
annotate:
runs-on: ubuntu-latest
steps:
- name: Download linting report
uses: actions/github-script@v3.1.0
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "eslint_report.zip"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/eslint_report.zip', Buffer.from(download.data));
- run: unzip eslint_report.zip
- run: ls -la
- name: Annotate linting
uses: ataylorme/eslint-annotate-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
report-json: "eslint_report.json"

View File

@ -5,8 +5,7 @@ on:
branches: branches:
- master - master
- dev - dev
pull_request_target: pull_request:
types: [opened, reopened, synchronize]
jobs: jobs:
linting: linting:
@ -25,16 +24,15 @@ jobs:
- name: Install Yarn packages - name: Install Yarn packages
run: yarn install run: yarn install
- name: Build Project
run: npm run build
- name: Run ESLint Report - name: Run ESLint Report
run: yarn lint:report run: yarn lint:report
# continue on error, so it still reports it in the next step # continue on error, so it still reports it in the next step
continue-on-error: true continue-on-error: true
- name: Annotate Code Linting Results - uses: actions/upload-artifact@v2
uses: ataylorme/eslint-annotate-action@v2
with: with:
repo-token: "${{ secrets.GITHUB_TOKEN }}" name: eslint_report.zip
report-json: "eslint_report.json" path: eslint_report.json
- name: Build Project
run: npm run build