Skip to content
This repository was archived by the owner on Oct 6, 2024. It is now read-only.
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@

# Generated files
index.html
lang
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
# good-first-issue
# good-first-issue.com

Make your first open-source contribution.


TODO Make with V by gomzyakov

https://gomzyakov.github.io/good-first-issue/


# Как добавить свой репозиторий?

todo [repositories.json](https://github.com/gomzyakov/good-first-issue/blob/main/repositories.json)


# Как это работает?

Expand All @@ -10,4 +20,6 @@ Make your first open-source contribution.
chmod u+x xxx.sh


https://api.github.com/repos/gomzyakov/good-first-issue/issues?state=open&sort=updated&labels=good%20first%20issue

Ежедневно запускается [cron.yml](#TODO) который _TODO_
52 changes: 47 additions & 5 deletions generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
// TODO To class + ->run()


// Удаляем все файлы (кроме .gitignore) из директории `./data`
if (!is_dir('lang')) {
mkdir('lang');
}


// Read the JSON file
Expand All @@ -20,7 +22,9 @@

// TODO Рандомизируем массив с репозиториями

$indexContent= "<h1>Hello!</h1>";
$indexContent = "<h1>Hello!</h1>";

$repositoriesByLanguage = [];

// Проходимся по всем репозиториям
foreach ($json_data as $line) {
Expand Down Expand Up @@ -54,15 +58,53 @@

print_r($repositoryData);

$indexContent .= '<h2>'.$repositoryData['full_name'].'</h2>';
$indexContent .= '<p>'.$repositoryData['description'].'</p>';
// Конетент для главной страницы
$indexContent .= '<h2>' . $repositoryData['full_name'] . '</h2>';
$indexContent .= '<p>' . $repositoryData['description'] . '</p>';

$repositoriesByLanguage[$repositoryData['language']][] = $repositoryData['full_name'];

// Записываем ищуйки в общий файл
}


file_put_contents('index.html', $indexContent);


file_put_contents('index.html', $indexContent);
foreach ($repositoriesByLanguage as $lang => $repositories) {
if (strlen($lang) < 1) {
$lang = 'other';
}

print_r('Language: ' . $lang);

$langFile = 'lang/' . $lang . '.html';
if (file_exists($langFile)) {
$status = unlink($langFile) ? 'The file ' . $langFile . ' has been deleted' . "\n" : 'Error deleting ' . $langFile . "\n";
echo $status;
}


// TODO Пишем шапку файла
file_put_contents($langFile, '<h1>Lang: ' . $lang . '</h1>' . "\n");

foreach ($repositories as $repository) {
print_r('Repository: ' . $repository."\n");

$issuesJson = file_get_contents('https://api.github.com/repos/' . $repository . '/issues?state=open&sort=updated&labels=good%20first%20issue', false, $context);
$issues = json_decode($issuesJson, true);

foreach ($issues as $issue) {
print_r('Issue #' . $issue['number'] . ' ' . $issue['title'] . "\n");

$str = '<p>' . $issue['title'] . '</p>';
$str .= '<p>' . $issue['html_url'] . '</p>';

file_put_contents($langFile, $str, FILE_APPEND);
}

}


}