From 9308f8490a0ae15804f780f6f931ea1507d9ab60 Mon Sep 17 00:00:00 2001 From: syadav3 Date: Tue, 1 Aug 2023 19:00:48 +0530 Subject: [PATCH 1/4] Added Changelog file check --- .github/workflows/build-core.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index 27900817..c6479fb4 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -44,11 +44,30 @@ jobs: github-repo: ${{ github.repository }} github-token: ${{ secrets.GITHUB_TOKEN }} - build: + check_changelog: runs-on: ubuntu-latest needs: check-permission steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Check if CHANGELOG is added + id: changed-files-yaml + uses: tj-actions/changed-files@v37 + with: + files_yaml: | + doc: + - CHANGELOG.md + + - name: Abort the workflow if CHANGELOG is not added + if: steps.changed-files-yaml.outputs.doc_any_changed != 'true' + run: | + echo "CHANGELOG + build: + runs-on: ubuntu-latest + needs: check_changelog + steps: - name: '[Prep 1] Cache node modules' uses: actions/cache@v2 with: From 50596f62126942cdece17648f3149bce1c6dfd11 Mon Sep 17 00:00:00 2001 From: syadav3 Date: Wed, 2 Aug 2023 16:51:56 +0530 Subject: [PATCH 2/4] Updated the code as per the suggestions --- .github/workflows/build-core.yml | 42 +++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index c6479fb4..85e96f4f 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -46,24 +46,44 @@ jobs: check_changelog: runs-on: ubuntu-latest - needs: check-permission steps: - name: Checkout code uses: actions/checkout@v3 - - - name: Check if CHANGELOG is added - id: changed-files-yaml - uses: tj-actions/changed-files@v37 with: - files_yaml: | - doc: - - CHANGELOG.md + path: copy-repo + fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} + + - name: Get changed files + id: changed-files + run: | + cd copy-repo + if ${{ github.event_name == 'pull_request' }}; then + echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT + else + echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT + fi - - name: Abort the workflow if CHANGELOG is not added - if: steps.changed-files-yaml.outputs.doc_any_changed != 'true' + - name: List changed files + id: set-flag run: | - echo "CHANGELOG + cd copy-repo + for file in ${{ steps.changed-files.outputs.changed_files }}; do + echo "$file was changed" + if [[ $file == "CHANGELOG.md" ]] + then + echo "file-flag=true" >> $GITHUB_OUTPUT + break; + else + echo "file-flag=false" >> $GITHUB_OUTPUT + fi + done + - name: Check if CHANGELOG is Updated and Abort if not updated + if: steps.set-flag.outputs.file-flag != 'true' + run: | + echo "CHANGELOG not added. Please add the CHANGELOG in the CHANGELOG.md file" + exit 1 + build: runs-on: ubuntu-latest needs: check_changelog From 2144b105f774c110919310422a86db4f1f9d3ece Mon Sep 17 00:00:00 2001 From: syadav3 Date: Wed, 2 Aug 2023 17:03:26 +0530 Subject: [PATCH 3/4] Updated code to Build to not fail even if Changelog not udpated --- .github/workflows/build-core.yml | 2 +- CHANGELOG.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index 85e96f4f..8874fbad 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -86,7 +86,7 @@ jobs: build: runs-on: ubuntu-latest - needs: check_changelog + needs: check-permission steps: - name: '[Prep 1] Cache node modules' uses: actions/cache@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ec16a5f..d8e91542 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,4 +82,4 @@ All notable changes to the Zlux App Server package will be documented in this fi - Add v1.12 update script for replacing all bundled plugin references with ones that use $ROOT_DIR environment variable - Change Scripts to work with independent zss component -- Add v1.12 update script for removing apiml-auth if it is not being explicitly used +- Add v1.12 update script for removing apiml-auth if it is not being explicitly used. From c6d3116f8e0d2284301c22c754a0006b9b340cb7 Mon Sep 17 00:00:00 2001 From: James Struga Date: Wed, 2 Aug 2023 19:36:53 -0400 Subject: [PATCH 4/4] Testing pr 275 Signed-off-by: James Struga --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8e91542..0ec16a5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,4 +82,4 @@ All notable changes to the Zlux App Server package will be documented in this fi - Add v1.12 update script for replacing all bundled plugin references with ones that use $ROOT_DIR environment variable - Change Scripts to work with independent zss component -- Add v1.12 update script for removing apiml-auth if it is not being explicitly used. +- Add v1.12 update script for removing apiml-auth if it is not being explicitly used