Skip to content

Commit 45c626b

Browse files
authored
feat: pw report publish - cleanup git history (#181)
* implement orphan branch approach to prevent git history bloat * update feedback text
1 parent 4294e19 commit 45c626b

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

playwright-gh-pages/deploy-report-pages/action.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,25 @@ runs:
8888
comment-tag: gf-playwright-test-results
8989
message: ${{ steps.generate-table.outputs.table }}
9090

91+
- name: Validate pages branch safety
92+
shell: bash
93+
run: |
94+
if [[ "$PAGES_BRANCH" == "main" || "$PAGES_BRANCH" == "master" ]]; then
95+
echo "ERROR: Cannot deploy to main/master branch"
96+
echo "Please use a dedicated branch like 'gh-pages' for Pages deployment."
97+
exit 1
98+
fi
99+
env:
100+
PAGES_BRANCH: ${{ inputs.pages-branch }}
101+
91102
- name: Push the new files to github pages
92103
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0
93104
with:
94105
publish_branch: ${{ inputs.pages-branch }}
95106
github_token: ${{ inputs.github-token }}
96107
publish_dir: all-reports
97108
destination_dir: ${{ steps.timestampid.outputs.timestamp }}/${{ steps.set-initiator.outputs.job_initiator }}
109+
force_orphan: true
98110

99111

100112
- name: Checkout code
@@ -119,7 +131,7 @@ runs:
119131
echo "No changes to commit"
120132
else
121133
git commit -m "Delete folders older than $RETENTION_DAYS days"
122-
git push origin $PAGES_BRANCH
134+
git push -f origin $PAGES_BRANCH
123135
fi
124136
env:
125137
RETENTION_DAYS: ${{ inputs.retention-days }}

0 commit comments

Comments
 (0)