mirror of
https://github.com/rico-vz/HeimerdingerLoL.git
synced 2025-12-06 10:10:48 +01:00
feat: Add function to retrieve commit hash
- Added a new function `getCommitHash` to fetch the latest commit hash using Git log command and cache it for 3 days.
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
use App\Models\ChampionImage;
|
||||
use Intervention\Image\Drivers\Gd\Driver;
|
||||
use Intervention\Image\ImageManager;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
function getRoleIcon($roleName): string
|
||||
{
|
||||
@@ -83,3 +84,13 @@ function getChampionImage($full_id, $type): string
|
||||
|
||||
return $championImage->url;
|
||||
}
|
||||
|
||||
function getCommitHash(): string
|
||||
{
|
||||
/** @var string $commit */
|
||||
$commit = Cache::remember('commit_hash', 60 * 72, function () {
|
||||
return trim(exec('git log --pretty="%h" -n1 HEAD'));
|
||||
});
|
||||
|
||||
return $commit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user