From 094dba37231421f052ec3c5ea128c12d556ece6c Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Fri, 7 Nov 2025 12:30:06 +0100 Subject: [PATCH 1/2] implement orphan branch approach to prevent git history bloat --- .../deploy-report-pages/action.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/playwright-gh-pages/deploy-report-pages/action.yml b/playwright-gh-pages/deploy-report-pages/action.yml index e360b47e..bf3aac3e 100644 --- a/playwright-gh-pages/deploy-report-pages/action.yml +++ b/playwright-gh-pages/deploy-report-pages/action.yml @@ -88,6 +88,18 @@ runs: comment-tag: gf-playwright-test-results message: ${{ steps.generate-table.outputs.table }} + - name: Validate pages branch safety + shell: bash + run: | + if [[ "$PAGES_BRANCH" == "main" || "$PAGES_BRANCH" == "master" ]]; then + echo "ERROR: Cannot deploy to main/master branch with force_orphan - this would destroy repository history!" + echo "Please use a dedicated branch like 'gh-pages' for Pages deployment." + exit 1 + fi + echo "✅ Pages branch '$PAGES_BRANCH' is safe for orphan deployment" + env: + PAGES_BRANCH: ${{ inputs.pages-branch }} + - name: Push the new files to github pages uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 with: @@ -95,6 +107,7 @@ runs: github_token: ${{ inputs.github-token }} publish_dir: all-reports destination_dir: ${{ steps.timestampid.outputs.timestamp }}/${{ steps.set-initiator.outputs.job_initiator }} + force_orphan: true - name: Checkout code @@ -119,7 +132,7 @@ runs: echo "No changes to commit" else git commit -m "Delete folders older than $RETENTION_DAYS days" - git push origin $PAGES_BRANCH + git push -f origin $PAGES_BRANCH fi env: RETENTION_DAYS: ${{ inputs.retention-days }} From 538b01bc6edcc3314e05cb312ae4b8e31ff3eb30 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Fri, 7 Nov 2025 14:10:05 +0100 Subject: [PATCH 2/2] update feedback text --- playwright-gh-pages/deploy-report-pages/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/playwright-gh-pages/deploy-report-pages/action.yml b/playwright-gh-pages/deploy-report-pages/action.yml index bf3aac3e..6763dcbb 100644 --- a/playwright-gh-pages/deploy-report-pages/action.yml +++ b/playwright-gh-pages/deploy-report-pages/action.yml @@ -92,11 +92,10 @@ runs: shell: bash run: | if [[ "$PAGES_BRANCH" == "main" || "$PAGES_BRANCH" == "master" ]]; then - echo "ERROR: Cannot deploy to main/master branch with force_orphan - this would destroy repository history!" + echo "ERROR: Cannot deploy to main/master branch" echo "Please use a dedicated branch like 'gh-pages' for Pages deployment." exit 1 fi - echo "✅ Pages branch '$PAGES_BRANCH' is safe for orphan deployment" env: PAGES_BRANCH: ${{ inputs.pages-branch }}