fix hoge #13
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: cppcheck | |
on: | |
pull_request: | |
jobs: | |
cppcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v1 | |
- name: Install Cppcheck | |
run: sudo apt-get install -y cppcheck | |
- name: Get changed files | |
id: changed-files | |
run: | | |
git fetch origin ${{ github.base_ref }} --depth=1 | |
git diff --name-only origin/${{ github.base_ref }} ${{ github.head_ref }} > changed_files.txt | |
cat changed_files.txt | |
- name: Run Cppcheck on changed files | |
run: | | |
files=$(cat changed_files.txt | grep '\.cpp$\|\.h$' | tr '\n' ' ') | |
if [ -n "$files" ]; then | |
cppcheck --enable=warning,style,performance --error-exitcode=1 $files | |
else | |
echo "No C++ files changed." | |
shell: bash |