From 6af9d7999bffe7aaec1475a58dd3edfaa52a651e Mon Sep 17 00:00:00 2001 From: i332371 Date: Fri, 1 Mar 2024 14:09:21 +0530 Subject: [PATCH 1/2] needed for cp in actions --- package.json | 4 ++-- xmpls/messaging/package.json | 4 ++-- xmpls/remote-service/package.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 2e9060e..1004e59 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,8 @@ "clone-add-attachments": "git clone https://github.com/cap-js/attachments.git && cp -r attachments/xmpl/db . && cp -r attachments/xmpl/app . && npm add https://github.com/cap-js/attachments.git", "add-notifications": "npm add @cap-js/notifications && cp xmpls/alert-notifications.js ./srv && cp xmpls/notification-types.json ./srv", "add-audit-log": "npm add @cap-js/audit-logging && cp xmpls/data-privacy.cds ./srv && cp xmpls/audit-log.test.js ./test", - "add-remote-service": "cp -r xmpls/remote-service/ .", - "add-messaging": "cp -r xmpls/messaging/ .", + "add-remote-service": "cp -r xmpls/remote-service/* .", + "add-messaging": "cp -r xmpls/messaging/* .", "add-all-xmpls": "npm run add-remote-service && npm run add-messaging && npm run add-change-tracking && npm run add-audit-log", "reset": "read -p 'This will irreversibly reset your working directory including ALL files in this git repo. Continue?' -n 1 -r && echo && if [[ $REPLY =~ ^[Yy]$ ]]; then git clean -fd && git reset --hard && npm i; fi" }, diff --git a/xmpls/messaging/package.json b/xmpls/messaging/package.json index 8a1299c..7759e67 100644 --- a/xmpls/messaging/package.json +++ b/xmpls/messaging/package.json @@ -34,8 +34,8 @@ "clone-add-attachments": "git clone https://github.com/cap-js/attachments.git && cp -r attachments/xmpl/db . && cp -r attachments/xmpl/app . && npm add https://github.com/cap-js/attachments.git", "add-notifications": "npm add @cap-js/notifications && cp xmpls/alert-notifications.js ./srv && cp xmpls/notification-types.json ./srv", "add-audit-log": "npm add @cap-js/audit-logging && cp xmpls/data-privacy.cds ./srv && cp xmpls/audit-log.test.js ./test", - "add-remote-service": "cp -r xmpls/remote-service/ .", - "add-messaging": "cp -r xmpls/messaging/ .", + "add-remote-service": "cp -r xmpls/remote-service/* .", + "add-messaging": "cp -r xmpls/messaging/* .", "add-all-xmpls": "npm run add-remote-service && npm run add-messaging && npm run add-change-tracking && npm run add-audit-log", "reset": "read -p 'This will irreversibly reset your working directory including ALL files in this git repo. Continue?' -n 1 -r && echo && if [[ $REPLY =~ ^[Yy]$ ]]; then git clean -fd && git reset --hard && npm i; fi" }, diff --git a/xmpls/remote-service/package.json b/xmpls/remote-service/package.json index 7a5b8cf..eb036f8 100644 --- a/xmpls/remote-service/package.json +++ b/xmpls/remote-service/package.json @@ -33,8 +33,8 @@ "clone-add-attachments": "git clone https://github.com/cap-js/attachments.git && cp -r attachments/xmpl/db . && cp -r attachments/xmpl/app . && npm add https://github.com/cap-js/attachments.git", "add-notifications": "npm add @cap-js/notifications && cp xmpls/alert-notifications.js ./srv && cp xmpls/notification-types.json ./srv", "add-audit-log": "npm add @cap-js/audit-logging && cp xmpls/data-privacy.cds ./srv && cp xmpls/audit-log.test.js ./test", - "add-remote-service": "cp -r xmpls/remote-service/ .", - "add-messaging": "cp -r xmpls/messaging/ .", + "add-remote-service": "cp -r xmpls/remote-service/* .", + "add-messaging": "cp -r xmpls/messaging/* .", "add-all-xmpls": "npm run add-remote-service && npm run add-messaging && npm run add-change-tracking && npm run add-audit-log", "reset": "read -p 'This will irreversibly reset your working directory including ALL files in this git repo. Continue?' -n 1 -r && echo && if [[ $REPLY =~ ^[Yy]$ ]]; then git clean -fd && git reset --hard && npm i; fi" }, From 15bdc683b11489bd734359769d0cf38b63e40a5f Mon Sep 17 00:00:00 2001 From: i332371 Date: Fri, 1 Mar 2024 14:12:47 +0530 Subject: [PATCH 2/2] workflow for CDS Test branch --- .github/workflows/create-test-branch.yml | 38 ++++++++++++++++++++++++ .github/workflows/node.js.yml | 5 ++++ 2 files changed, 43 insertions(+) create mode 100644 .github/workflows/create-test-branch.yml diff --git a/.github/workflows/create-test-branch.yml b/.github/workflows/create-test-branch.yml new file mode 100644 index 0000000..2521b82 --- /dev/null +++ b/.github/workflows/create-test-branch.yml @@ -0,0 +1,38 @@ +name: Create CDS Test branch + +on: + workflow_call: + +jobs: + build: + runs-on: ubuntu-latest + name: Build and Push + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Copy xmpls + run: npm run add-all-xmpls + + - name: Test + run: | + npm i + npm test + + - name: Extract last commit author email and name + id: extract_commit_info + run: | + LAST_COMMIT_EMAIL=$(git log -1 --pretty=format:'%ae') + LAST_COMMIT_NAME=$(git log -1 --pretty=format:'%an') + echo "AUTHOR_EMAIL=$LAST_COMMIT_EMAIL" >> $GITHUB_ENV + echo "AUTHOR_NAME=$LAST_COMMIT_NAME" >> $GITHUB_ENV + + - name: Push + run: | + git config --global user.email "${{ env.AUTHOR_EMAIL }}" + git config --global user.name "${{ env.AUTHOR_NAME }}" + # Add and commit changes locally + git add . + git commit -m "${{ github.event.head_commit.message }}" + git push --force-with-lease origin HEAD:cds-test-integrate diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 1b810f8..30053e6 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -27,3 +27,8 @@ jobs: node-version: ${{ matrix.node-version }} - run: npm i - run: npm test + + push: + name: Push to CDS Test branch + uses: ./.github/workflows/create-test-branch.yml + if: github.event_name == 'push'