Skip to content
This repository was archived by the owner on Oct 20, 2025. It is now read-only.

Commit 28bfe12

Browse files
committed
Refactor GitHub Actions workflow for main branch handling and enhance composer scripts with post-install command
1 parent 3e81ec9 commit 28bfe12

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@ jobs:
6363
6464
- name: Push changes to main
6565
run: |
66-
git branch -M main
66+
git branch main
67+
git checkout main
6768
git merge origin/dev
69+
git pull origin main
6870
git push origin main
6971
env:
7072
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
"preferred-install": "dist"
4747
},
4848
"scripts": {
49-
"test": "phpunit || vendor/bin/phpunit || php vendor/bin/phpunit"
49+
"test": "phpunit || vendor/bin/phpunit || php vendor/bin/phpunit",
50+
"post-install-cmd": [ "PhpSlides\\Core\\Cache\\Cache::clear()" ]
5051
},
5152
"minimum-stability": "stable",
5253
"prefer-stable": true

src/Cache/Cache.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class Cache
2020
* effectively clearing all cached files. It is commonly used to
2121
* reset the cache during development or when cache corruption occurs.
2222
*/
23-
public function clear ()
23+
public static function clear ()
2424
{
2525
// Check if the cache directory exists
2626
if (is_dir(Application::$basePath . 'app/cache'))
@@ -37,7 +37,7 @@ public function clear ()
3737
* It is typically used during development when hot reload functionality
3838
* needs to be reset or reloaded.
3939
*/
40-
public function clearHotReload ()
40+
public static function clearHotReload ()
4141
{
4242
// Check if the hot-reload cache file exists
4343
if (file_exists(Application::$basePath . 'app/cache/hot-reload.json'))
@@ -46,4 +46,4 @@ public function clearHotReload ()
4646
unlink(Application::$basePath . 'app/cache/hot-reload.json');
4747
}
4848
}
49-
}
49+
}

0 commit comments

Comments
 (0)