Skip to content

Commit

Permalink
ci(reports): remove reports of deleted branch (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinezanardi committed Feb 24, 2024
1 parent c6dab73 commit a58cee7
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/branch-deletion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: 🍃 Branch Deletion Workflow

on:
delete:
branches:
- '*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH_NAME: ""
BRANCH_NAME_FORMATTED_FOR_REPORTS: ""

jobs:
delete-reports-folder:
name: Delete Reports Folder on GitHub Pages 🗑
runs-on: ubuntu-latest

steps:
- name: Checkout GitHub repository 📡
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0

- name: Set up Git 🛠️
run: |
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
- name: Extract branch name without prefix and format it 🌲
run: |
BRANCH_NAME=$(echo "${{ github.event.ref }}" | sed 's/refs\/heads\///')
BRANCH_NAME_FORMATTED_FOR_REPORTS=$(echo "${BRANCH_NAME//\//_}")
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo "BRANCH_NAME_FORMATTED_FOR_REPORTS=$BRANCH_NAME_FORMATTED_FOR_REPORTS" >> $GITHUB_ENV
- name: Delete Reports Folder 🗑
run: |
git checkout github_pages
rm -rf "reports/vitest/$BRANCH_NAME_FORMATTED_FOR_REPORTS"
rm -rf "reports/stryker/$BRANCH_NAME_FORMATTED_FOR_REPORTS"
rm -rf "reports/cucumber/$BRANCH_NAME_FORMATTED_FOR_REPORTS"
git add .
git commit -m "chore(reports): delete reports folder for branch $BRANCH_NAME_FORMATTED_FOR_REPORTS"
git push origin github_pages
1 change: 1 addition & 0 deletions .github/workflows/upsert-pr-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:

- name: Merge main branch into develop branch 🤝
run: |
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
git fetch --all
git checkout main
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ You can find all the workflows in the **[.github/workflows directory](https://gi
| **[🔃️ Upsert PR Release Workflow](https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/workflows/upsert-pr-release.yml)** | Creates or updates pull request to `main` depending on commits on `develop` since last release<br/><br/>[![🔃️ Upsert PR Release Workflow](https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/workflows/upsert-pr-release.yml/badge.svg)](https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/workflows/upsert-pr-release.yml) | `push` on `develop` |
| **[🏷️ Release Creation Workflow](https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/workflows/release-creation.yml)** | Creates a new release using `semantic-release` with tag and updated changelog<br/><br/>[![🏷️ Release Creation Workflow](https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/workflows/release-creation.yml/badge.svg)](https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/workflows/release-creation.yml) | `push` on `main` |
| **[🚀 Deploy To Production Workflow](https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/workflows/deploy-to-production.yml)** | Deploys app with last tag version to `Docker Hub` and `GCP`<br/><br/>[![🚀 Deploy To Production Workflow](https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/workflows/deploy-to-production.yml/badge.svg)](https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/workflows/deploy-to-production.yml) | `tag-creation` |
| **[🍃 Branch Deletion Workflow](https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/workflows/branch-deletion.yml)** | Remove all reports for the deleted branch<br/><br/>[![🍃 Branch Deletion Workflow](https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/workflows/branch-deletion.yml/badge.svg)](https://github.com/antoinezanardi/werewolves-assistant-web-next/actions/workflows/branch-deletion.yml) | `delete` on all branches |

## <a name="misc-commands">✨ Misc commands</a>

Expand Down

0 comments on commit a58cee7

Please sign in to comment.