diff --git a/.github/workflows/check_diff.yml b/.github/workflows/check_diff.yml new file mode 100644 index 00000000000..8c0dd8ba12d --- /dev/null +++ b/.github/workflows/check_diff.yml @@ -0,0 +1,29 @@ +name: Check changed files + +on: + pull_request: + +concurrency: + group: ${{ github.ref }}-${{ github.head_ref }}-checkdiff + cancel-in-progress: true + +jobs: + check_diff: + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Get changed files + run: | + git diff --name-only --diff-filter=ACMRTUXB ${GITHUB_BASE_REF}..${GITHUB_HEAD_REF} > check_diff.txt + - name: Check changed files + run: | + if grep -v -E "^(docs|\.github)/" check_diff.txt; then + echo "skip=false" >> ${GITHUB_OUTPUT} + else + echo "skip=true" >> ${GITHUB_OUTPUT} + fi + outputs: + skip: ${{ steps.check.outputs.skip_workflows }} diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml index 2209f425d1f..e34edee2e2d 100644 --- a/.github/workflows/cuda.yml +++ b/.github/workflows/cuda.yml @@ -5,6 +5,9 @@ on: branches: - "development" pull_request: + workflow_run: + workflows: [Check changed files] + types: [completed] concurrency: group: ${{ github.ref }}-${{ github.head_ref }}-cuda @@ -18,7 +21,7 @@ jobs: build_nvcc: name: NVCC 11.3 SP runs-on: ubuntu-20.04 - if: github.event.pull_request.draft == false + if: ${{ github.event.pull_request.draft == false && github.event.workflow_run.outputs.skip == "false" }} env: CXXFLAGS: "-Werror" CMAKE_GENERATOR: Ninja @@ -110,7 +113,7 @@ jobs: build_nvcc_gnumake: name: NVCC 11.8.0 GNUmake runs-on: ubuntu-20.04 - if: github.event.pull_request.draft == false + if: ${{ github.event.pull_request.draft == false && github.event.workflow_run.outputs.skip == "false" }} steps: - uses: actions/checkout@v4 - name: install dependencies @@ -144,7 +147,7 @@ jobs: build_nvhpc24-1-nvcc: name: NVHPC@24.1 NVCC/NVC++ Release [tests] runs-on: ubuntu-20.04 - if: github.event.pull_request.draft == false + if: ${{ github.event.pull_request.draft == false && github.event.workflow_run.outputs.skip == "false" }} #env: # # For NVHPC, Ninja is slower than the default: # CMAKE_GENERATOR: Ninja