2023-03-10 19:10:08 +01:00
|
|
|
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
|
2023-03-10 19:25:14 +01:00
|
|
|
uses: actions/github-script@v6
|
2023-03-10 19:10:08 +01:00
|
|
|
with:
|
|
|
|
script: |
|
2023-03-10 19:38:59 +01:00
|
|
|
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
|
2023-03-10 19:10:08 +01:00
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
run_id: ${{github.event.workflow_run.id }},
|
|
|
|
});
|
2023-03-10 19:38:59 +01:00
|
|
|
const matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
2023-03-10 19:25:14 +01:00
|
|
|
return artifact.name == "eslint_report.json"
|
2023-03-10 19:10:08 +01:00
|
|
|
})[0];
|
2023-03-10 19:38:59 +01:00
|
|
|
const download = await github.rest.actions.downloadArtifact({
|
2023-03-10 19:10:08 +01:00
|
|
|
owner: context.repo.owner,
|
|
|
|
repo: context.repo.repo,
|
|
|
|
artifact_id: matchArtifact.id,
|
|
|
|
archive_format: 'zip',
|
|
|
|
});
|
2023-03-10 19:38:59 +01:00
|
|
|
const fs = require('fs');
|
2023-03-10 19:10:08 +01:00
|
|
|
fs.writeFileSync('${{github.workspace}}/eslint_report.zip', Buffer.from(download.data));
|
|
|
|
|
|
|
|
- run: unzip eslint_report.zip
|
|
|
|
|
|
|
|
- run: ls -la
|
|
|
|
|
|
|
|
- name: Annotate linting
|
2023-03-10 19:34:25 +01:00
|
|
|
uses: ataylorme/eslint-annotate-action@v2
|
2023-03-10 19:10:08 +01:00
|
|
|
with:
|
|
|
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
|
|
|
report-json: "eslint_report.json"
|