From cf2560eb26ced66c49fedec1f7d6b64040cc34d1 Mon Sep 17 00:00:00 2001 From: Santoshkumar Nateekar Date: Thu, 20 Feb 2025 21:30:41 +0530 Subject: [PATCH] [NALA][MWPW-168075] Purge cache before running NALA tests on PR (#3698) * add branch purgining before test run * update the pr.sh * add 10 sec wait to purge completion * added wait time --------- Co-authored-by: Santoshkumar Sharanappa Nateekar --- .github/workflows/run-nala-default.yml | 2 ++ nala/utils/pr.run.sh | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/.github/workflows/run-nala-default.yml b/.github/workflows/run-nala-default.yml index 4031be7c8d..40bbdd24af 100644 --- a/.github/workflows/run-nala-default.yml +++ b/.github/workflows/run-nala-default.yml @@ -10,6 +10,8 @@ on: - stage - main types: [opened, synchronize, reopened] + + workflow_dispatch: jobs: run-nala-tests: diff --git a/nala/utils/pr.run.sh b/nala/utils/pr.run.sh index 96cbc30180..c749ad2f55 100755 --- a/nala/utils/pr.run.sh +++ b/nala/utils/pr.run.sh @@ -42,6 +42,23 @@ export PR_NUMBER echo "PR Branch live URL: $PR_BRANCH_LIVE_URL_GH" +# Purge the PR branch before running tests +echo "Purging branch: $FEATURE_BRANCH" +PURGE_URL="https://admin.hlx.page/code/$prOrg/$prRepo/$FEATURE_BRANCH/*" + +echo "Executing: curl -si -X POST \"$PURGE_URL\"" +PURGE_RESPONSE=$(curl -si -X POST "$PURGE_URL") + +echo "Waiting 10 seconds for purge to complete..." +sleep 10 + +# Check if the purge was successful +if echo "$PURGE_RESPONSE" | grep -q "202"; then + echo "Branch $FEATURE_BRANCH successfully purged" +else + echo "Failed to purge branch $FEATURE_BRANCH" + echo "Response: $PURGE_RESPONSE" +fi # Convert GitHub Tag(@) labels that can be grepped for label in ${labels}; do