From 4d8f77632628ffa508340d9b5535edd540177cb0 Mon Sep 17 00:00:00 2001 From: munapower Date: Thu, 22 Feb 2024 02:35:00 -0500 Subject: [PATCH] Modify actions to avoid processing when only doc PRs (#754) - Update paths filter to recent version - Avoid running FPC test when only changes to markdown files (docu updates) - Add new workflow for documentation --------- Signed-off-by: munapower Signed-off-by: Marcus Brandenburger Co-authored-by: Marcus Brandenburger --- .github/workflows/documentation.yml | 41 +++++++++++++++++++++++++++++ .github/workflows/test.yml | 14 +++++++--- 2 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/documentation.yml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 000000000..d2ed9232e --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,41 @@ +# +# SPDX-License-Identifier: Apache-2.0 +# + +name: Check Documentation +on: + push: + paths: + - '**.md' +defaults: + run: + shell: bash +permissions: {} +jobs: + check-md-only: + name: This job was triggered + runs-on: ubuntu-latest + outputs: + md-only: ${{ steps.test-md-only.outputs.md-only }} + permissions: + contents: read + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 2 # required to compare HEAD^ + - run: git diff --name-only HEAD^..HEAD + - name: Test MD only + id: test-md-only + run: >- + [ -z "$(git diff --name-only HEAD^..HEAD | grep -ve "\.md$")" ] && + echo "md-only=${{toJSON(true)}}" >> $GITHUB_OUTPUT || + echo "md-only=${{toJSON(false)}}" >> $GITHUB_OUTPUT + build: + name: Run if only MD files + needs: ['check-md-only'] + runs-on: ubuntu-latest + if: ${{ fromJSON(needs.check-md-only.outputs.md-only) == true }} + steps: + - run: echo ran + diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 77725dc61..36c371a97 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,8 +3,15 @@ # name: FPC test -on: [push, pull_request] - +on: + push: + paths-ignore: + - '**.md' + - '.github/workflows/**' + pull_request: + paths-ignore: + - '**.md' + - '.github/workflows/**' env: DOCKER_REGISTRY: 'ghcr.io' PUSH_TO_MAIN: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} @@ -25,13 +32,12 @@ jobs: with: submodules: 'recursive' - - uses: dorny/paths-filter@v2 + - uses: dorny/paths-filter@v3 id: filter with: filters: | docker: - 'utils/docker/**' - - name: build dev image if: steps.filter.outputs.docker == 'true' env: