feat: [WD-13704] Create image from backup file #234
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Delete playwright test reports | |
on: | |
pull_request_target: | |
types: | |
- closed | |
jobs: | |
delete_reports: | |
name: Delete Playwright Test Reports for PR ${{ github.event.number }} | |
runs-on: ubuntu-latest | |
env: | |
# Folder on gh-pages branch that contains all test reports for a PR | |
PR_REPORTS_DIR: reports/pr-${{ github.event.number }} | |
steps: | |
- uses: actions/checkout@main | |
with: | |
ref: gh-pages | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set Git User | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
- name: Check for workflow reports | |
id: has-reports | |
run: | | |
if [ -z "$(ls -A $PR_REPORTS_DIR)" ]; then | |
echo "PR_REPORTS_EXISTS=false" >> $GITHUB_OUTPUT | |
else | |
echo "PR_REPORTS_EXISTS=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Delete reports from repo for PR ${{ github.event.number }} | |
if: ${{ steps.has-reports.outputs.PR_REPORTS_EXISTS == 'true' }} | |
timeout-minutes: 3 | |
run: | | |
rm -rf reports/pr-${{ github.event.number }} | |
git add . | |
git commit -m "workflow: remove all reports for PR #${{ github.event.number }}" | |
# In case if another action job pushed to gh-pages while we are rebasing for the current job | |
while true; do | |
git pull --rebase | |
if [ $? -ne 0 ]; then | |
echo "Failed to rebase. Please review manually." | |
exit 1 | |
fi | |
git push | |
if [ $? -eq 0 ]; then | |
echo "Successfully pushed HTML reports to repo." | |
exit 0 | |
fi | |
done | |