use master for clang-tidy-pr-comments

This commit is contained in:
Jelle Spijker 2022-12-10 16:05:07 +01:00 committed by GitHub
parent c309b594c2
commit 9f3490893a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 116 additions and 116 deletions

View File

@ -1,59 +1,59 @@
name: printer-linter-pr-diagnose name: printer-linter-pr-diagnose
on: on:
pull_request: pull_request:
path: path:
- 'resources/**' - "resources/**"
jobs: jobs:
printer-linter-diagnose: printer-linter-diagnose:
name: Printer linter PR diagnose name: Printer linter PR diagnose
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
fetch-depth: 2 fetch-depth: 2
- name: Setup Python and pip - name: Setup Python and pip
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
python-version: 3.11.x python-version: 3.11.x
cache: 'pip' cache: "pip"
cache-dependency-path: .github/workflows/requirements-printer-linter.txt cache-dependency-path: .github/workflows/requirements-printer-linter.txt
- uses: technote-space/get-diff-action@v6 - uses: technote-space/get-diff-action@v6
with: with:
PATTERNS: | PATTERNS: |
resources/+(extruders|definitions)/*.def.json resources/+(extruders|definitions)/*.def.json
resources/+(intent|quality|variants)/**/*.inst.cfg resources/+(intent|quality|variants)/**/*.inst.cfg
- name: Install Python requirements for runner - name: Install Python requirements for runner
if: env.GIT_DIFF && !env.MATCHED_FILES if: env.GIT_DIFF && !env.MATCHED_FILES
run: pip install -r .github/workflows/requirements-printer-linter.txt run: pip install -r .github/workflows/requirements-printer-linter.txt
- name: Create results directory - name: Create results directory
run: mkdir printer-linter-result run: mkdir printer-linter-result
- name: Diagnose file(s) - name: Diagnose file(s)
if: env.GIT_DIFF && !env.MATCHED_FILES if: env.GIT_DIFF && !env.MATCHED_FILES
run: python printer-linter/src/terminal.py --diagnose --report printer-linter-result/fixes.yml ${{ env.GIT_DIFF_FILTERED }} run: python printer-linter/src/terminal.py --diagnose --report printer-linter-result/fixes.yml ${{ env.GIT_DIFF_FILTERED }}
- name: Save PR metadata - name: Save PR metadata
run: | run: |
echo ${{ github.event.number }} > printer-linter-result/pr-id.txt echo ${{ github.event.number }} > printer-linter-result/pr-id.txt
echo ${{ github.event.pull_request.head.repo.full_name }} > printer-linter-result/pr-head-repo.txt echo ${{ github.event.pull_request.head.repo.full_name }} > printer-linter-result/pr-head-repo.txt
echo ${{ github.event.pull_request.head.ref }} > printer-linter-result/pr-head-ref.txt echo ${{ github.event.pull_request.head.ref }} > printer-linter-result/pr-head-ref.txt
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: printer-linter-result name: printer-linter-result
path: printer-linter-result/ path: printer-linter-result/
- name: Run clang-tidy-pr-comments action - name: Run clang-tidy-pr-comments action
uses: platisd/clang-tidy-pr-comments@fix_suggestions_for_multiline_comments uses: platisd/clang-tidy-pr-comments@master
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
clang_tidy_fixes: result.yml clang_tidy_fixes: result.yml
request_changes: true request_changes: true

View File

@ -1,81 +1,81 @@
name: printer-linter-pr-post name: printer-linter-pr-post
on: on:
workflow_run: workflow_run:
workflows: [ "printer-linter-pr-diagnose" ] workflows: ["printer-linter-pr-diagnose"]
types: [ completed ] types: [completed]
jobs: jobs:
clang-tidy-results: clang-tidy-results:
# Trigger the job only if the previous (insecure) workflow completed successfully # Trigger the job only if the previous (insecure) workflow completed successfully
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Download analysis results - name: Download analysis results
uses: actions/github-script@v3.1.0 uses: actions/github-script@v3.1.0
with: with:
script: | script: |
let artifacts = await github.actions.listWorkflowRunArtifacts({ let artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }}, run_id: ${{github.event.workflow_run.id }},
}); });
let matchArtifact = artifacts.data.artifacts.filter((artifact) => { let matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "printer-linter-result" return artifact.name == "printer-linter-result"
})[0]; })[0];
let download = await github.actions.downloadArtifact({ let download = await github.actions.downloadArtifact({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
artifact_id: matchArtifact.id, artifact_id: matchArtifact.id,
archive_format: "zip", archive_format: "zip",
}); });
let fs = require("fs"); let fs = require("fs");
fs.writeFileSync("${{github.workspace}}/printer-linter-result.zip", Buffer.from(download.data)); fs.writeFileSync("${{github.workspace}}/printer-linter-result.zip", Buffer.from(download.data));
- name: Set environment variables - name: Set environment variables
run: | run: |
mkdir printer-linter-result mkdir printer-linter-result
unzip printer-linter-result.zip -d printer-linter-result unzip printer-linter-result.zip -d printer-linter-result
echo "pr_id=$(cat printer-linter-result/pr-id.txt)" >> $GITHUB_ENV echo "pr_id=$(cat printer-linter-result/pr-id.txt)" >> $GITHUB_ENV
echo "pr_head_repo=$(cat printer-linter-result/pr-head-repo.txt)" >> $GITHUB_ENV echo "pr_head_repo=$(cat printer-linter-result/pr-head-repo.txt)" >> $GITHUB_ENV
echo "pr_head_ref=$(cat printer-linter-result/pr-head-ref.txt)" >> $GITHUB_ENV echo "pr_head_ref=$(cat printer-linter-result/pr-head-ref.txt)" >> $GITHUB_ENV
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
repository: ${{ env.pr_head_repo }} repository: ${{ env.pr_head_repo }}
ref: ${{ env.pr_head_ref }} ref: ${{ env.pr_head_ref }}
persist-credentials: false persist-credentials: false
- name: Redownload analysis results - name: Redownload analysis results
uses: actions/github-script@v3.1.0 uses: actions/github-script@v3.1.0
with: with:
script: | script: |
let artifacts = await github.actions.listWorkflowRunArtifacts({ let artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }}, run_id: ${{github.event.workflow_run.id }},
}); });
let matchArtifact = artifacts.data.artifacts.filter((artifact) => { let matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "printer-linter-result" return artifact.name == "printer-linter-result"
})[0]; })[0];
let download = await github.actions.downloadArtifact({ let download = await github.actions.downloadArtifact({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo, repo: context.repo.repo,
artifact_id: matchArtifact.id, artifact_id: matchArtifact.id,
archive_format: "zip", archive_format: "zip",
}); });
let fs = require("fs"); let fs = require("fs");
fs.writeFileSync("${{github.workspace}}/printer-linter-result.zip", Buffer.from(download.data)); fs.writeFileSync("${{github.workspace}}/printer-linter-result.zip", Buffer.from(download.data));
- name: Extract analysis results - name: Extract analysis results
run: | run: |
mkdir printer-linter-result mkdir printer-linter-result
unzip printer-linter-result.zip -d printer-linter-result unzip printer-linter-result.zip -d printer-linter-result
- name: Run clang-tidy-pr-comments action - name: Run clang-tidy-pr-comments action
uses: platisd/clang-tidy-pr-comments@fix_suggestions_for_multiline_comments uses: platisd/clang-tidy-pr-comments@master
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
clang_tidy_fixes: printer-linter-result/fixes.yml clang_tidy_fixes: printer-linter-result/fixes.yml
pull_request_id: ${{ env.pr_id }} pull_request_id: ${{ env.pr_id }}
request_changes: true request_changes: true