sudo-archive/.github/workflows/linting_annotate.yml

49 lines
1.5 KiB
YAML
Raw Normal View History

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