-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (42 loc) · 1.3 KB
/
delete-pages.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Delete old folders from GitHub Pages
on:
push:
branches:
- "gh-pages"
schedule:
- cron: '0 0 * * *' # This will run the workflow daily at midnight UTC
jobs:
delete_old_folders:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Set up Node
- uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
- name: Get current directory
run: echo "CURRENT_DIR=$(pwd)" >> $GITHUB_ENV
- name: Run the script
run: node removeOldFolders.js "${{ env.CURRENT_DIR }}"
- name: Commit all changed files back to the repository
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: gh-pages
commit_message: Delete folders older than 30 days
notify_on_delete_pages_failure:
runs-on: ubuntu-latest
needs:
- delete_old_folders
if: failure()
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_TITLE: ":boom: The nightly delete of expired Playwright reports job has failed in ${{ github.repository }}."
MSG_MINIMAL: true
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}"