Skip to content

Commit

Permalink
chore(ci): change way to modified files for cppcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
HansRobo committed Jun 20, 2024
1 parent 73e22ca commit 9981257
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/cppcheck-differential.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set PR fetch depth
run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}"

- name: Checkout PR branch and all PR commits
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: ${{ env.PR_FETCH_DEPTH }}

- name: Install dependencies
run: |
Expand All @@ -29,12 +35,16 @@ jobs:
make -j $(nproc)

Check warning on line 35 in .github/workflows/cppcheck-differential.yaml

View workflow job for this annotation

GitHub Actions / spell-check-differential

Unknown word (nproc)
sudo make install
- name: Fetch the base branch with enough history for a common merge-base commit
run: git fetch origin ${{ inputs.base-ref }}
shell: bash

- name: Get changed files
id: changed-files
run: |
git fetch origin ${{ github.base_ref }} --depth=1
git diff --name-only FETCH_HEAD ${{ github.sha }} > changed_files.txt
git diff --name-only "origin/${{ inputs.base-ref }}"...HEAD > changed_files.txt
cat changed_files.txt
shell: bash

- name: Run Cppcheck on changed files
continue-on-error: true
Expand Down

0 comments on commit 9981257

Please sign in to comment.