From 28790484492f63b83db1644b2fcee34b58494f03 Mon Sep 17 00:00:00 2001 From: Hitensh Kharva <56474017+hitenshKharva@users.noreply.github.com> Date: Fri, 13 Oct 2023 16:42:13 -0700 Subject: [PATCH] Run manifest check only aganist the changed manifest (#4101) Signed-off-by: Hitensh Kharva --- .github/workflows/manifests.yml | 40 +++++++++++++++------------------ 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/.github/workflows/manifests.yml b/.github/workflows/manifests.yml index 3c0917b424..c16301ffb8 100644 --- a/.github/workflows/manifests.yml +++ b/.github/workflows/manifests.yml @@ -2,43 +2,40 @@ name: manifests on: - push: pull_request: paths: - 'manifests/**/*.yml' - '!manifests/templates/**/' - schedule: - - cron: 0 0 * * * jobs: - list-manifests11: + list-changed-manifests: runs-on: ubuntu-latest outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} steps: - - uses: actions/checkout@v3 - - id: set-matrix - run: echo "::set-output name=matrix::$(ls manifests/**/opensearch*.yml | awk -F/ '{if($2<2)print$0}' | jq -R -s -c 'split("\n")[:-1]')" - - list-manifests17: - runs-on: ubuntu-latest - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - steps: - - uses: actions/checkout@v3 - - id: set-matrix - run: echo "::set-output name=matrix::$(ls manifests/**/opensearch*.yml | awk -F/ '{if($2>2)print$0}' | jq -R -s -c 'split("\n")[:-1]')" + - name: Checkout + uses: actions/checkout@v3 + - name: Get changed manifest files + uses: tj-actions/changed-files@v39 + id: list-changed-manifests + with: + files: manifests/**/opensearch*.yml + json: true + quotepath: false + dir_names: false + - name: Set unique changed manifests as matrix + id: set-matrix + run: echo "matrix={\"manifest\":${{ steps.list-changed-manifests.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT" manifest-checks-jdk11: - needs: list-manifests11 + needs: [list-changed-manifests] runs-on: ubuntu-latest env: PYTHON_VERSION: 3.9 JDK_VERSION: 11 strategy: - matrix: - manifest: ${{ fromJson(needs.list-manifests11.outputs.matrix) }} + matrix: ${{ fromJson(needs.list-changed-manifests.outputs.matrix) }} steps: - uses: actions/checkout@v3 - name: Set Up JDK ${{ env.JDK_VERSION }} @@ -57,14 +54,13 @@ jobs: ./ci.sh ${{ matrix.manifest }} --snapshot manifest-checks-jdk17: - needs: list-manifests17 + needs: [list-changed-manifests] runs-on: ubuntu-latest env: PYTHON_VERSION: 3.9 JDK_VERSION: 17 strategy: - matrix: - manifest: ${{ fromJson(needs.list-manifests17.outputs.matrix) }} + matrix: ${{ fromJson(needs.list-changed-manifests.outputs.matrix) }} steps: - uses: actions/checkout@v3 - name: Set Up JDK ${{ env.JDK_VERSION }}