clang-format-lint-action icon indicating copy to clipboard operation
clang-format-lint-action copied to clipboard

Allow to not found source files option

Open Tacha-S opened this issue 4 years ago • 1 comments

If we try to set up GitHub CI when we create a repository, then no source file exists. In that case, the GitHub CI will be an error, so we want an option to allow the source file to not exist.

Tacha-S avatar Jun 23 '21 04:06 Tacha-S

I would like this feature as well.

As a workaround, I just added a step to the job that checks if the directory exists or not.

name: Clang Format Lint

on:
  pull_request:
    branches: [master, nightly]
    types: [opened, synchronize, reopened]

jobs:
  lint:
    name: Clang Format Lint
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Check src
        run: |
          if [ -d "./src" ] 
          then
            FOUND=true
          else
            FOUND=false
          fi
          
          echo "src_found=${FOUND}" >> $GITHUB_ENV

      - name: Clang format lint
        if: ${{ env.src_found == 'true' }}
        uses: DoozyX/[email protected]
        with:
          source: './src'
          extensions: 'cpp,h,m,mm'
          clangFormatVersion: 13
          style: file
          inplace: false

      - name: Upload Artifacts
        if: failure()
        uses: actions/upload-artifact@v3
        with:
          name: clang-format-fixes
          path: src/

ReenigneArcher avatar Jul 11 '22 02:07 ReenigneArcher