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