|
| 1 | +# This file is automatically synced from: |
| 2 | +# https://github.com/autowarefoundation/sync-file-templates |
| 3 | +# To make changes, update the source repository and follow the guidelines in its README. |
| 4 | + |
| 5 | +name: clang-tidy-pr-comments-manually |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + inputs: |
| 10 | + workflow_run_id_or_url: |
| 11 | + description: The target workflow run ID or URL of the build-and-test-differential workflow |
| 12 | + required: true |
| 13 | +jobs: |
| 14 | + clang-tidy-pr-comments-manually: |
| 15 | + runs-on: ubuntu-22.04 |
| 16 | + steps: |
| 17 | + - name: Check out repository |
| 18 | + uses: actions/checkout@v3 |
| 19 | + |
| 20 | + - name: Download analysis results |
| 21 | + run: | |
| 22 | + workflow_run_id=$(echo "${{ inputs.workflow_run_id_or_url }}" | sed -e "s|.*runs/||" -e "s|/jobs.*||") |
| 23 | + gh run download "$workflow_run_id" -D /tmp || true |
| 24 | + env: |
| 25 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + |
| 27 | + - name: Check if the fixes.yaml file exists |
| 28 | + id: check-fixes-yaml-existence |
| 29 | + uses: autowarefoundation/autoware-github-actions/check-file-existence@v1 |
| 30 | + with: |
| 31 | + files: /tmp/clang-tidy-result/fixes.yaml |
| 32 | + |
| 33 | + - name: Set variables |
| 34 | + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} |
| 35 | + id: set-variables |
| 36 | + run: | |
| 37 | + echo "pr-id=$(cat /tmp/clang-tidy-result/pr-id.txt)" >> $GITHUB_OUTPUT |
| 38 | + echo "pr-head-repo=$(cat /tmp/clang-tidy-result/pr-head-repo.txt)" >> $GITHUB_OUTPUT |
| 39 | + echo "pr-head-ref=$(cat /tmp/clang-tidy-result/pr-head-ref.txt)" >> $GITHUB_OUTPUT |
| 40 | +
|
| 41 | + - name: Check out PR head |
| 42 | + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} |
| 43 | + uses: actions/checkout@v3 |
| 44 | + with: |
| 45 | + repository: ${{ steps.set-variables.outputs.pr-head-repo }} |
| 46 | + ref: ${{ steps.set-variables.outputs.pr-head-ref }} |
| 47 | + persist-credentials: false |
| 48 | + |
| 49 | + - name: Replace paths in fixes.yaml |
| 50 | + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} |
| 51 | + run: | |
| 52 | + sed -i -e "s|/__w/|/home/runner/work/|g" /tmp/clang-tidy-result/fixes.yaml |
| 53 | + cat /tmp/clang-tidy-result/fixes.yaml |
| 54 | +
|
| 55 | + - name: Copy fixes.yaml to access from Docker Container Action |
| 56 | + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} |
| 57 | + run: | |
| 58 | + cp /tmp/clang-tidy-result/fixes.yaml fixes.yaml |
| 59 | +
|
| 60 | + - name: Run clang-tidy-pr-comments action |
| 61 | + if: ${{ steps.check-fixes-yaml-existence.outputs.exists == 'true' }} |
| 62 | + uses: platisd/clang-tidy-pr-comments@v1 |
| 63 | + with: |
| 64 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + clang_tidy_fixes: fixes.yaml |
| 66 | + pull_request_id: ${{ steps.set-variables.outputs.pr-id }} |
0 commit comments