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