From 21e66a6e4ca4a41231ad0b3b8ec08bfd35c52a2e Mon Sep 17 00:00:00 2001 From: syadav3 Date: Tue, 1 Aug 2023 19:00:48 +0530 Subject: [PATCH 01/23] Added Changelog file check Signed-off-by: Himani1519 --- .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 62e9512f654c528d6c70a9a6e772a59060631af3 Mon Sep 17 00:00:00 2001 From: syadav3 Date: Wed, 2 Aug 2023 16:51:56 +0530 Subject: [PATCH 02/23] Updated the code as per the suggestions Signed-off-by: Himani1519 --- .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 405c5a47627f5205c7828be275f9a3b40cd9f47b Mon Sep 17 00:00:00 2001 From: syadav3 Date: Wed, 2 Aug 2023 17:03:26 +0530 Subject: [PATCH 03/23] Updated code to Build to not fail even if Changelog not udpated Signed-off-by: Himani1519 --- .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 ac727bb4584227809b91a5c1d579ea1ab9a2f5fa Mon Sep 17 00:00:00 2001 From: syadav3 Date: Thu, 3 Aug 2023 23:54:31 +0530 Subject: [PATCH 04/23] Removed temporary dir after Check changelog Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index 8874fbad..84bbbd5d 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -81,8 +81,12 @@ jobs: - 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" + echo "CHANGELOG.md not updated, please update CHANGELOG.md with the changes made in the pull request" exit 1 + + - name: Remove copy-repo + if: always() + run: rm -r copy-repo build: runs-on: ubuntu-latest From 5a80c83080f4272d1c4e4aebc70e9f769f9982ae Mon Sep 17 00:00:00 2001 From: syadav3 Date: Thu, 3 Aug 2023 23:59:52 +0530 Subject: [PATCH 05/23] Updated Changelog to original Signed-off-by: Himani1519 --- 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 From 21d4b8b1bdbcdd34008f1cc16ed11328375f1e52 Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Wed, 9 Aug 2023 14:33:31 +0530 Subject: [PATCH 06/23] MVD-5924 Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 75 +++++++++++++++++++------------- 1 file changed, 44 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index 84bbbd5d..25d5ee38 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -46,47 +46,60 @@ jobs: check_changelog: runs-on: ubuntu-latest + outputs: + was_updated: ${{ steps.check.outputs.was_updated }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v2 with: - path: copy-repo - fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }} + fetch-depth: 2 - - name: Get changed files - id: changed-files + - name: Check if CHANGELOG.md was updated + id: check 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: List changed files - id: set-flag - run: | - 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' + if git diff --name-only HEAD^ HEAD | grep 'CHANGELOG.md'; then + echo "CHANGELOG.md was updated in the last commit." + echo "::set-output name=was_updated::true" + else + echo "CHANGELOG.md was NOT updated in the last commit." + echo "::set-output name=was_updated::false" + fi + - name: Check if CHANGELOG is Updated and if not updated pass to update_changelog + if: ${{ steps.check.outputs.was_updated != 'true' }} run: | - echo "CHANGELOG.md not updated, please update CHANGELOG.md with the changes made in the pull request" - exit 1 + echo "CHANGELOG not added. Please add the CHANGELOG in the CHANGELOG.md file" - name: Remove copy-repo if: always() run: rm -r copy-repo + + + update_changelog: + needs: check_changelog + runs-on: ubuntu-latest + if: ${{ needs.check_changelog.outputs.was_updated == 'false' }} + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 2 + + - name: Get commit message + run: echo "COMMIT_MESSAGE=$(git log --format=%B -n 1)" >> $GITHUB_ENV + + + - name: Append commit to Changelog + run: | + echo "CHANGELOG: $COMMIT_MESSAGE" >> CHANGELOG.md + echo "${{ steps.check-changelog.outputs.was_updated}}" + + - name: Commit and push if it changed + run: | + git diff + git config --global user.email "actions@github.com" + git config --global user.name "GitHub Actions" + git commit -am "Update Changelog" -m "$COMMIT_MESSAGE" && echo ::set-output name=push::true || echo "No changes to commit" + git push origin || echo "No changes to push" build: runs-on: ubuntu-latest From a7b1389d0d488eec77fbbe6df86f1a2fd89b177d Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Wed, 9 Aug 2023 14:35:00 +0530 Subject: [PATCH 07/23] MVD-5924 Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index 25d5ee38..e429b4cb 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -67,7 +67,7 @@ jobs: - name: Check if CHANGELOG is Updated and if not updated pass to update_changelog if: ${{ steps.check.outputs.was_updated != 'true' }} run: | - echo "CHANGELOG not added. Please add the CHANGELOG in the CHANGELOG.md file" + echo "CHANGELOG.md not updated, please update CHANGELOG.md with the changes made in the pull request" - name: Remove copy-repo if: always() From f93a33cda1eb2ec279202f7c10f9f85530a2eeb6 Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Wed, 9 Aug 2023 15:53:58 +0530 Subject: [PATCH 08/23] MVD-5924 Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index e429b4cb..826deacf 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -69,9 +69,6 @@ jobs: run: | echo "CHANGELOG.md not updated, please update CHANGELOG.md with the changes made in the pull request" - - name: Remove copy-repo - if: always() - run: rm -r copy-repo update_changelog: From 57bf3ab65f7519f88e65b42837d75abc0ed4461d Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Wed, 9 Aug 2023 20:42:24 +0530 Subject: [PATCH 09/23] MVD-5924 Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index 826deacf..7802da2a 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -69,9 +69,7 @@ jobs: run: | echo "CHANGELOG.md not updated, please update CHANGELOG.md with the changes made in the pull request" - - - update_changelog: + update_changelog: needs: check_changelog runs-on: ubuntu-latest if: ${{ needs.check_changelog.outputs.was_updated == 'false' }} @@ -97,7 +95,7 @@ jobs: git config --global user.name "GitHub Actions" git commit -am "Update Changelog" -m "$COMMIT_MESSAGE" && echo ::set-output name=push::true || echo "No changes to commit" git push origin || echo "No changes to push" - + build: runs-on: ubuntu-latest needs: check-permission @@ -113,7 +111,7 @@ jobs: key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-build-cache-node-modules- - + - name: '[Prep 2] Setup Node' uses: actions/setup-node@v2 with: @@ -149,6 +147,7 @@ jobs: pax-ssh-username: ${{ secrets.SSH_MARIST_USERNAME }} pax-ssh-password: ${{ secrets.SSH_MARIST_RACF_PASSWORD }} pax-name: zlux-core - + - name: '[Prep 7] deploy' uses: zowe-actions/zlux-builds/core/deploy@v2.x/main + From 06d867a054a5433c54da2d7ea251a1f8419b8efc Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Thu, 17 Aug 2023 11:23:56 +0530 Subject: [PATCH 10/23] Automate changelog note Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 81 +++++++++++++++++++------------- 1 file changed, 48 insertions(+), 33 deletions(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index 7802da2a..fa3d9e0e 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -44,57 +44,72 @@ jobs: github-repo: ${{ github.repository }} github-token: ${{ secrets.GITHUB_TOKEN }} - check_changelog: + update-changelog: runs-on: ubuntu-latest outputs: - was_updated: ${{ steps.check.outputs.was_updated }} + was_updated: ${{ steps.check-change.outputs.change_detected }} steps: - name: Checkout code uses: actions/checkout@v2 with: - fetch-depth: 2 + ref: ${{ github.head_ref }} - - name: Check if CHANGELOG.md was updated - id: check + - name: Extract changelog info + id: extract-changelog run: | - if git diff --name-only HEAD^ HEAD | grep 'CHANGELOG.md'; then - echo "CHANGELOG.md was updated in the last commit." - echo "::set-output name=was_updated::true" + PR_DESCRIPTION="${{ github.event.pull_request.body }}" + + # Check if "changelog:" exists in PR description + if [[ $PR_DESCRIPTION == *"CHANGELOG:"* ]]; then + + # Extract text after "changelog:" + CHANGELOG_TEXT=$(echo $PR_DESCRIPTION | sed -n 's/.*CHANGELOG: \(.*\)/\1/p') + + echo "Extracted changelog: $CHANGELOG_TEXT" + echo "::set-output name=changelog::$CHANGELOG_TEXT" else - echo "CHANGELOG.md was NOT updated in the last commit." - echo "::set-output name=was_updated::false" + echo "No changelog information found in PR description please add the changelog note" + exit 1 fi - - name: Check if CHANGELOG is Updated and if not updated pass to update_changelog - if: ${{ steps.check.outputs.was_updated != 'true' }} + + - name: Check PR body against changelog run: | - echo "CHANGELOG.md not updated, please update CHANGELOG.md with the changes made in the pull request" + if ! grep -Fq "${{ steps.extract-changelog.outputs.changelog }}" CHANGELOG.md; then + LINE_NUMBER=$(awk '/^##/{print NR; exit}' CHANGELOG.md) + sed -i "${LINE_NUMBER} a- ${{ steps.extract-changelog.outputs.changelog }} . (#${{ github.event.pull_request.number }})" CHANGELOG.md + # echo "${{ steps.extract-changelog.outputs.changelog }}" >> CHANGELOG.md + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add CHANGELOG.md + git commit -m "Update changelog with PR #${{ github.event.pull_request.number }} description" + git push + fi - update_changelog: - needs: check_changelog + - name: check for changes + id: check-change + run: | + if git diff --name-only HEAD^ HEAD | grep 'changelog.md'; then + echo "No Changes detected, setting flag to false" + echo "::set-output name=change_detected::false" + else + echo "::set-output name=change_detected::true" + fi + + check_changelog: + needs: update-changelog runs-on: ubuntu-latest - if: ${{ needs.check_changelog.outputs.was_updated == 'false' }} steps: - name: Checkout code uses: actions/checkout@v2 - with: - fetch-depth: 2 - - - name: Get commit message - run: echo "COMMIT_MESSAGE=$(git log --format=%B -n 1)" >> $GITHUB_ENV - - - - name: Append commit to Changelog - run: | - echo "CHANGELOG: $COMMIT_MESSAGE" >> CHANGELOG.md - echo "${{ steps.check-changelog.outputs.was_updated}}" - - name: Commit and push if it changed + - name: Verify Changelog update run: | - git diff - git config --global user.email "actions@github.com" - git config --global user.name "GitHub Actions" - git commit -am "Update Changelog" -m "$COMMIT_MESSAGE" && echo ::set-output name=push::true || echo "No changes to commit" - git push origin || echo "No changes to push" + if [ "${{ needs.update-changelog.outputs.was_updated }}" != "true" ]; then + echo "CHANGELOG.md not updated, please update CHANGELOG.md with the changes made in the pull request" + exit 1 + else + echo "changelog was updated successfully." + fi build: runs-on: ubuntu-latest From b81d55c5dab120329122cc9d28f66c7f295a9577 Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Thu, 17 Aug 2023 11:31:02 +0530 Subject: [PATCH 11/23] fixed syntax error Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index fa3d9e0e..e7411ef1 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -95,21 +95,21 @@ jobs: echo "::set-output name=change_detected::true" fi - check_changelog: - needs: update-changelog - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Verify Changelog update - run: | - if [ "${{ needs.update-changelog.outputs.was_updated }}" != "true" ]; then - echo "CHANGELOG.md not updated, please update CHANGELOG.md with the changes made in the pull request" - exit 1 - else - echo "changelog was updated successfully." - fi + check_changelog: + needs: update-changelog + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Verify Changelog update + run: | + if [ "${{ needs.update-changelog.outputs.was_updated }}" != "true" ]; then + echo "CHANGELOG.md not updated, please update CHANGELOG.md with the changes made in the pull request" + exit 1 + else + echo "changelog was updated successfully." + fi build: runs-on: ubuntu-latest From 82447e693d99bb5e9d45a31b1221557e2d2b9d20 Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Thu, 17 Aug 2023 11:46:52 +0530 Subject: [PATCH 12/23] To test Signed-off-by: Himani1519 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 74639a54..a503e9bd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -This program and the accompanying materials are + This program and the accompanying materials are made available under the terms of the Eclipse Public License v2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html From b4f12c000a810e4f45204f15b35f8edd165c8e27 Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Tue, 22 Aug 2023 00:51:50 +0530 Subject: [PATCH 13/23] Add more checks Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 73 +++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index e7411ef1..8c1b7943 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -48,43 +48,66 @@ jobs: runs-on: ubuntu-latest outputs: was_updated: ${{ steps.check-change.outputs.change_detected }} + check_commit: ${{ steps.check-changelog.outputs.check_commit }} steps: - name: Checkout code uses: actions/checkout@v2 with: ref: ${{ github.head_ref }} + fetch-depth: 0 + - name: Check for updated CHANGELOG.md using git + id: check-changelog + run: | + if git diff --name-only origin/${{ github.base_ref }} | grep -q "^CHANGELOG.md$"; then + echo "CHANGELOG.md has been updated." + echo "::set-output name=check_commit::true" + else + echo "ERROR: CHANGELOG.md has not been updated." + echo "::set-output name=check_commit::false" + fi - name: Extract changelog info + if: steps.check-changelog.outputs.check_commit == 'false' id: extract-changelog run: | PR_DESCRIPTION="${{ github.event.pull_request.body }}" - # Check if "changelog:" exists in PR description - if [[ $PR_DESCRIPTION == *"CHANGELOG:"* ]]; then - + if echo "$PR_DESCRIPTION" | grep -q "VERSION:" && echo "$PR_DESCRIPTION" | grep -q "CHANGELOG:"; then # Extract text after "changelog:" CHANGELOG_TEXT=$(echo $PR_DESCRIPTION | sed -n 's/.*CHANGELOG: \(.*\)/\1/p') - + # Extract VERSION: from PR description + VERSION=$(echo "$PR_DESCRIPTION" | grep -oP 'VERSION:\s*\Kv\d+\.\d+\.\d+') echo "Extracted changelog: $CHANGELOG_TEXT" echo "::set-output name=changelog::$CHANGELOG_TEXT" + echo "::set-output name=version::$VERSION" else - echo "No changelog information found in PR description please add the changelog note" + echo "No changelog and version information found in PR description please add them" exit 1 fi - - name: Check PR body against changelog + if: steps.check-changelog.outputs.check_commit == 'false' run: | + set -eux if ! grep -Fq "${{ steps.extract-changelog.outputs.changelog }}" CHANGELOG.md; then - LINE_NUMBER=$(awk '/^##/{print NR; exit}' CHANGELOG.md) - sed -i "${LINE_NUMBER} a- ${{ steps.extract-changelog.outputs.changelog }} . (#${{ github.event.pull_request.number }})" CHANGELOG.md - # echo "${{ steps.extract-changelog.outputs.changelog }}" >> CHANGELOG.md + # Check if version exists in CHANGELOG.md + if grep -q "## ${{ steps.extract-changelog.outputs.version }}" CHANGELOG.md; then + # Append PR description to existing version + sed -i "/## ${{ steps.extract-changelog.outputs.version }}/ a- ${{ steps.extract-changelog.outputs.changelog }} . (#${{ github.event.pull_request.number }})" CHANGELOG.md + else + # Append new version and PR description + echo "$(awk '/All notable changes to the Zlux App Server package will be documented in this file\./ { + print + print "\n## " "${{ steps.extract-changelog.outputs.version }}" + print "- " "${{ steps.extract-changelog.outputs.changelog }}" " (#${{ github.event.pull_request.number }})" + next + } 1' CHANGELOG.md)" > CHANGELOG.md + fi git config --local user.email "action@github.com" git config --local user.name "GitHub Action" git add CHANGELOG.md git commit -m "Update changelog with PR #${{ github.event.pull_request.number }} description" git push fi - - name: check for changes id: check-change run: | @@ -95,21 +118,21 @@ jobs: echo "::set-output name=change_detected::true" fi - check_changelog: - needs: update-changelog - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Verify Changelog update - run: | - if [ "${{ needs.update-changelog.outputs.was_updated }}" != "true" ]; then - echo "CHANGELOG.md not updated, please update CHANGELOG.md with the changes made in the pull request" - exit 1 - else - echo "changelog was updated successfully." - fi + check_changelog: + needs: update-changelog + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Verify Changelog update + run: | + if [ "${{ needs.update-changelog.outputs.was_updated }}" != "true" ]; then + echo "CHANGELOG.md not updated, please update CHANGELOG.md with the changes made in the pull request" + exit 1 + else + echo "changelog was updated successfully." + fi build: runs-on: ubuntu-latest From 6b2850dda3471b81362d9bf0caf2fecb9ffd21ee Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 17 Aug 2023 06:01:16 +0000 Subject: [PATCH 14/23] Update changelog with PR #278 description Signed-off-by: Himani1519 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ec16a5f..2ad93be4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to the Zlux App Server package will be documented in this file. ## v2.11.0 +- This action making a CHANGELOG note via special syntax from the GitHub PR commit message, like it could automatically update CHANGELOG.md with the message. First job checks if PR body has changelog note or not if it's not there then it asked them to add it and second job is to check if changelog note has been added in changelog.md file or not. . (#278) - Bugfix: The server couldn't load more than one certificate authority specified within the zowe.certificate.pem.certificateAuthorities section under any condition. Now, it is supported regardless of if the section is an array or a comma-separated string. (#266) From 93ed4e701dc24c137617ff88025d4fad8c972b6a Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Tue, 22 Aug 2023 00:59:22 +0530 Subject: [PATCH 15/23] Add more checks Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index 8c1b7943..e09ff666 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -118,7 +118,7 @@ jobs: echo "::set-output name=change_detected::true" fi - check_changelog: + check_changelog: needs: update-changelog runs-on: ubuntu-latest steps: From 3cc71792fc876752f23ec6d6f3ac3e26fa53018d Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Tue, 22 Aug 2023 01:35:22 +0530 Subject: [PATCH 16/23] update msg Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index e09ff666..46e279cd 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -81,13 +81,13 @@ jobs: echo "::set-output name=changelog::$CHANGELOG_TEXT" echo "::set-output name=version::$VERSION" else - echo "No changelog and version information found in PR description please add them" + echo -e "No changelog and version information found in PR description please add them\n Expected Format VERSION:vX.XX.X\n CHANGELOG:This is changelog note\n + To re-run the action, just pushed/commit the changes along with PR description, it will automatically triggered by sync." exit 1 fi - name: Check PR body against changelog if: steps.check-changelog.outputs.check_commit == 'false' run: | - set -eux if ! grep -Fq "${{ steps.extract-changelog.outputs.changelog }}" CHANGELOG.md; then # Check if version exists in CHANGELOG.md if grep -q "## ${{ steps.extract-changelog.outputs.version }}" CHANGELOG.md; then From 016abb6fd1f8b0ace790236f9edb1a9135b275c3 Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Tue, 22 Aug 2023 01:37:24 +0530 Subject: [PATCH 17/23] update msg Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index 46e279cd..ae946937 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -81,7 +81,7 @@ jobs: echo "::set-output name=changelog::$CHANGELOG_TEXT" echo "::set-output name=version::$VERSION" else - echo -e "No changelog and version information found in PR description please add them\n Expected Format VERSION:vX.XX.X\n CHANGELOG:This is changelog note\n + echo -e "No changelog and version information found in PR description please add them.\n Expected Format VERSION:vX.XX.X\n CHANGELOG:This is changelog note.\n To re-run the action, just pushed/commit the changes along with PR description, it will automatically triggered by sync." exit 1 fi From 7d7b0b6b814fe26089052c396dbe428937eb5978 Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Tue, 22 Aug 2023 01:39:21 +0530 Subject: [PATCH 18/23] update msg Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index ae946937..60dc99d7 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -81,7 +81,7 @@ jobs: echo "::set-output name=changelog::$CHANGELOG_TEXT" echo "::set-output name=version::$VERSION" else - echo -e "No changelog and version information found in PR description please add them.\n Expected Format VERSION:vX.XX.X\n CHANGELOG:This is changelog note.\n + echo -e "No changelog and version information found in PR description please add them.\n Expected Format:\n VERSION:vX.XX.X\n CHANGELOG:This is changelog note.\n To re-run the action, just pushed/commit the changes along with PR description, it will automatically triggered by sync." exit 1 fi From 2e41a8b7634e02b630305a6364d33100eb8af38e Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Tue, 22 Aug 2023 14:20:29 +0530 Subject: [PATCH 19/23] Minor change Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index 60dc99d7..d6332586 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -82,7 +82,7 @@ jobs: echo "::set-output name=version::$VERSION" else echo -e "No changelog and version information found in PR description please add them.\n Expected Format:\n VERSION:vX.XX.X\n CHANGELOG:This is changelog note.\n - To re-run the action, just pushed/commit the changes along with PR description, it will automatically triggered by sync." + To re-run the action, just make a push or commit after updating the PR description or updating the changelog via a manual file changing commit." exit 1 fi - name: Check PR body against changelog @@ -92,7 +92,7 @@ jobs: # Check if version exists in CHANGELOG.md if grep -q "## ${{ steps.extract-changelog.outputs.version }}" CHANGELOG.md; then # Append PR description to existing version - sed -i "/## ${{ steps.extract-changelog.outputs.version }}/ a- ${{ steps.extract-changelog.outputs.changelog }} . (#${{ github.event.pull_request.number }})" CHANGELOG.md + sed -i "/## ${{ steps.extract-changelog.outputs.version }}/ a- ${{ steps.extract-changelog.outputs.changelog }} (#${{ github.event.pull_request.number }})" CHANGELOG.md else # Append new version and PR description echo "$(awk '/All notable changes to the Zlux App Server package will be documented in this file\./ { From 9a0af94367d9aa6d220b297ff3cf43d425c38695 Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Wed, 23 Aug 2023 20:03:45 +0530 Subject: [PATCH 20/23] Minor changes Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index d6332586..d7be5efa 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -88,20 +88,21 @@ jobs: - name: Check PR body against changelog if: steps.check-changelog.outputs.check_commit == 'false' run: | - if ! grep -Fq "${{ steps.extract-changelog.outputs.changelog }}" CHANGELOG.md; then - # Check if version exists in CHANGELOG.md - if grep -q "## ${{ steps.extract-changelog.outputs.version }}" CHANGELOG.md; then + ESCAPED_CHANGELOG="${{ steps.extract-changelog.outputs.changelog }}" + ESCAPED_CHANGELOG=$(echo "$ESCAPED_CHANGELOG" | sed "s/'/\\\\'/g") + VERSION="${{ steps.extract-changelog.outputs.version }}" + + if ! grep -Fq "$ESCAPED_CHANGELOG" CHANGELOG.md; then + # Check if version exists in CHANGELOG.md + if grep -q "^## $VERSION" CHANGELOG.md; then # Append PR description to existing version - sed -i "/## ${{ steps.extract-changelog.outputs.version }}/ a- ${{ steps.extract-changelog.outputs.changelog }} (#${{ github.event.pull_request.number }})" CHANGELOG.md + sed -i "/^## $VERSION/a - $ESCAPED_CHANGELOG (#${{ github.event.pull_request.number }})" CHANGELOG.md else # Append new version and PR description - echo "$(awk '/All notable changes to the Zlux App Server package will be documented in this file\./ { - print - print "\n## " "${{ steps.extract-changelog.outputs.version }}" - print "- " "${{ steps.extract-changelog.outputs.changelog }}" " (#${{ github.event.pull_request.number }})" - next - } 1' CHANGELOG.md)" > CHANGELOG.md - fi + ANCHOR_LINE=$(awk '/All notable changes to the Zlux App Server package will be documented in this file\./ {print NR}' CHANGELOG.md) + sed -i "$ANCHOR_LINE a\\ + \n## $VERSION\n- $ESCAPED_CHANGELOG (#${{ github.event.pull_request.number }})\n" CHANGELOG.md + fi git config --local user.email "action@github.com" git config --local user.name "GitHub Action" git add CHANGELOG.md From 33ecca8c818edee77c79e16a26a81e2c8950e61a Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Tue, 29 Aug 2023 20:22:51 +0530 Subject: [PATCH 21/23] minor change Signed-off-by: Himani1519 --- .github/workflows/build-core.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-core.yml b/.github/workflows/build-core.yml index d7be5efa..1f7c6354 100644 --- a/.github/workflows/build-core.yml +++ b/.github/workflows/build-core.yml @@ -103,10 +103,10 @@ jobs: sed -i "$ANCHOR_LINE a\\ \n## $VERSION\n- $ESCAPED_CHANGELOG (#${{ github.event.pull_request.number }})\n" CHANGELOG.md fi - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" + git config --global user.email "zowe-robot@users.noreply.github.com" + git config --global user.name "Zowe Robot" git add CHANGELOG.md - git commit -m "Update changelog with PR #${{ github.event.pull_request.number }} description" + git commit -s -m "Update changelog with PR #${{ github.event.pull_request.number }} description" git push fi - name: check for changes From 3ac948e559e72efaacbd6905b0e96dfa88902003 Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Tue, 29 Aug 2023 20:43:02 +0530 Subject: [PATCH 22/23] update changelog Signed-off-by: Himani1519 --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ad93be4..35243587 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,7 @@ All notable changes to the Zlux App Server package will be documented in this file. ## v2.11.0 -- This action making a CHANGELOG note via special syntax from the GitHub PR commit message, like it could automatically update CHANGELOG.md with the message. First job checks if PR body has changelog note or not if it's not there then it asked them to add it and second job is to check if changelog note has been added in changelog.md file or not. . (#278) - +- This action making a CHANGELOG note via special syntax from the GitHub PR commit message, like it could automatically update CHANGELOG.md with the message. First job checks if PR body has changelog note or not if it's not there then it asked them to add it and second job is to check if changelog note has been added in changelog.md file or not.(#278) - Bugfix: The server couldn't load more than one certificate authority specified within the zowe.certificate.pem.certificateAuthorities section under any condition. Now, it is supported regardless of if the section is an array or a comma-separated string. (#266) ## v2.10.0 From da005e3baa4ad05cf839ea1cb58503da6f246d64 Mon Sep 17 00:00:00 2001 From: Himani1519 Date: Tue, 5 Sep 2023 20:53:05 +0530 Subject: [PATCH 23/23] update changelog.md Signed-off-by: Himani1519 --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35243587..8e95ea96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,6 @@ All notable changes to the Zlux App Server package will be documented in this file. ## v2.11.0 -- This action making a CHANGELOG note via special syntax from the GitHub PR commit message, like it could automatically update CHANGELOG.md with the message. First job checks if PR body has changelog note or not if it's not there then it asked them to add it and second job is to check if changelog note has been added in changelog.md file or not.(#278) - Bugfix: The server couldn't load more than one certificate authority specified within the zowe.certificate.pem.certificateAuthorities section under any condition. Now, it is supported regardless of if the section is an array or a comma-separated string. (#266) ## v2.10.0