Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

github: [Gokujo,]
ko_fi: devcraft
custom: ['https://paypal.me/MaximH', 'https://sobe.ru/na/devcraftclub', 'https://yoomoney.ru/to/41001454367103', 'https://www.donationalerts.com/r/maharder', 'https://devcraft.club/donate/drives/na-chaj.1/']
custom: ['https://paypal.me/MaximH', 'https://sobe.ru/na/devcraftclub', 'https://yoomoney.ru/to/41001454367103', 'https://www.donationalerts.com/r/maharder']
7 changes: 6 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ body:
label: Версия DLE
description: На какой версии DLE это произошло?
options:
- "16.x (Default)"
- "17.3 (Default)"
- "17.2"
- "17.1"
- "17.0"
- "17.х"
- "16.x"
- "15.x"
- "14.x"
- "13.x"
Expand Down
7 changes: 6 additions & 1 deletion .github/ISSUE_TEMPLATE/custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ body:
label: Версия DLE
description: На какую версию DLE расчитывать?
options:
- "16.x (Default)"
- "17.3 (Default)"
- "17.2"
- "17.1"
- "17.0"
- "17.х"
- "16.x"
- "15.x"
- "14.x"
- "13.x"
Expand Down
7 changes: 6 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ body:
label: Версия DLE
description: На какую версию DLE расчитывать?
options:
- "16.x (Default)"
- "17.3 (Default)"
- "17.2"
- "17.1"
- "17.0"
- "17.х"
- "16.x"
- "15.x"
- "14.x"
- "13.x"
Expand Down
68 changes: 68 additions & 0 deletions .github/scripts/update_readme.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
// Пути к файлам
$ROOT = dirname(__FILE__, 3);

$manifestPath = ROOT . '/manifest.json';
$readmePath = ROOT . '/README.md';

// Проверяем наличие manifest.json
if (!file_exists($manifestPath)) {
die("Файл manifest.json не найден.\n");
}

// Читаем и парсим manifest.json
$manifestContent = file_get_contents($manifestPath);
$manifest = json_decode($manifestContent, true);

// Проверяем корректность JSON
if (json_last_error() !== JSON_ERROR_NONE) {
die("Ошибка парсинга JSON: " . json_last_error_msg() . "\n");
}

// Формируем badges
$badges = [];

// Badge: Текущая версия
if (isset($manifest['version'])) {
$badges[] = "![Текущая версия](https://img.shields.io/badge/version-{$manifest['version']}-green?style=for-the-badge)";
}

// Badge: Статус
if (isset($manifest['status'])) {
$badges[] = "![Статус](https://img.shields.io/badge/status-{$manifest['status']}-orange?style=for-the-badge)";
}

// Badge: DLE Version
if (!empty($manifest['dle']) && is_array($manifest['dle'])) {
$dleVersions = implode(', ', $manifest['dle']);
$badges[] = "![DLE Version](https://img.shields.io/badge/DLE-$dleVersions-blue?style=for-the-badge)";
}

// Badge: PHP Version
if (!empty($manifest['php']) && is_array($manifest['php'])) {
$phpVersions = implode(', ', $manifest['php']);
$badges[] = "![PHP Version](https://img.shields.io/badge/PHP-$phpVersions-red?style=for-the-badge)";
}

// Генерируем Markdown для badges
$newBadgesMarkdown = implode("", $badges);

// Читаем README.md
if (!file_exists($readmePath)) {
die("Файл README.md не найден.\n");
}
$readmeContent = file_get_contents($readmePath);

// Обновляем badges в README.md
$updatedReadmeContent = preg_replace(
'/(?<=# MHAdmin\n\n)(.*?)(?=\n\n\[)/s',
$newBadgesMarkdown . "\n",
$readmeContent
);

// Сохраняем обновленный README.md
if (file_put_contents($readmePath, $updatedReadmeContent) !== false) {
echo "README.md успешно обновлен.\n";
} else {
echo "Ошибка обновления README.md.\n";
}
34 changes: 34 additions & 0 deletions .github/workflows/update-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Update README

on:
push:
paths:
- "manifest.json"

jobs:
update-readme:
runs-on: ubuntu-latest

steps:
# Шаг 1: Клонируем репозиторий
- name: Checkout repository
uses: actions/checkout@v3

# Шаг 2: Устанавливаем PHP
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'

# Шаг 3: Запускаем скрипт
- name: Run PHP script
run: php ./.github/workflows/update_readme.php

# Шаг 4: Коммит изменений
- name: Commit changes
run: |
git config --local user.name "GitHub Actions"
git config --local user.email "actions@github.com"
git add README.md .last_manifest_version
git commit -m "Update README.md based on manifest.json"
git push
Loading
Loading