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

Commit 0163132

Browse files
authored
Take issues with good first issues labels from the GitHub API and show them (#188)
1 parent 52d9858 commit 0163132

18 files changed

+347
-768
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.4.0alpha4-alpine
1+
FROM php:8.3.9-alpine
22

33
ENV COMPOSER_HOME="/tmp/composer"
44

README.md

Lines changed: 107 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -75,35 +75,120 @@
7575

7676
# Good First Issues
7777

78-
**Good First Issues** is an initiative to curate easy pickings from popular projects, so developers who've never contributed to open-source can get started quickly.
78+
**Good First Issues** helps you make your first contribution to open-source. Developers who've never contributed to open-source can get started quickly.
7979

8080
Website: [good-first-issues.github.io](https://good-first-issues.github.io)
8181

8282
This website is primarily targeted at developers who want to contribute to open source software but do not know where or how to start.
8383

8484
Open-source maintainers are always looking to get more people involved, but new developers generally think it's challenging to become a contributor. We believe getting developers to fix super-easy issues removes the barrier for future contributions. This is why *Good First Issues* exists.
8585

86-
## Adding a new project
87-
88-
You're welcome to add a new project in *Good First Issues*, just follow these steps:
89-
90-
- To maintain the quality of projects in *Good First Issues*, please make sure your GitHub repository meets the following criteria:
91-
92-
- It has at least three issues with the `good first issue` label. This label is already present on all repositories by default.
93-
94-
- It contains a `README.md` with detailed setup instructions for the project
95-
96-
- It is actively maintained (last update less than 1 month ago)
97-
98-
- Add your repository's path (in the format `owner/name` and lexicographic order) in [repositories.json](https://github.com/gomzyakov/good-first-issue/blob/main/repositories.json).
99-
100-
- Create a new pull-request. Please add the link to the issues page of the repository in the PR description. Once the pull request is merged, the changes will be live on [good-first-issues.github.io](https://good-first-issues.github.io).
101-
102-
## How does it work?
103-
104-
- First *Good First Issues* is a static website that uses [PHP](https://www.php.net)` to generate HTML files.
105-
- We use [GitHub REST API](https://docs.github.com/en/rest) to fetch issues from the repositories listed in [repositories.json](https://github.com/gomzyakov/good-first-issue/blob/main/repositories.json).
106-
- To periodically cycle through issues (twice a day), we use [GitHub Workflow](https://docs.github.com/en/actions/using-workflows).
86+
## How it works?
87+
88+
App send the request to GutHub API for each programming language:
89+
90+
```bash
91+
curl -L \
92+
-H "Accept: application/vnd.github+json" \
93+
-H "X-GitHub-Api-Version: 2022-11-28" \
94+
"https://api.github.com/search/issues?q=label:\"good+first+issue\"+language:php+state:open+no:assignee&sort=updated&order=desc&per_page=50&page=1"
95+
```
96+
97+
And get the response with JSON-array with information about issues:
98+
99+
```json
100+
[
101+
{
102+
"url": "https://api.github.com/repos/symfony/ux/issues/1480",
103+
"repository_url": "https://api.github.com/repos/symfony/ux",
104+
"labels_url": "https://api.github.com/repos/symfony/ux/issues/1480/labels{/name}",
105+
"comments_url": "https://api.github.com/repos/symfony/ux/issues/1480/comments",
106+
"events_url": "https://api.github.com/repos/symfony/ux/issues/1480/events",
107+
"html_url": "https://github.com/symfony/ux/issues/1480",
108+
"id": 2125792255,
109+
"node_id": "I_kwDOEuCKh85-tQP_",
110+
"number": 1480,
111+
"title": "[UX Dropzone] drag'n'drop replacement fail",
112+
"user": {
113+
"login": "3PSY0N",
114+
"id": 78256817,
115+
"node_id": "MDQ6VXNlcjc4MjU2ODE3",
116+
"avatar_url": "https://avatars.githubusercontent.com/u/78256817?v=4",
117+
"gravatar_id": "",
118+
"url": "https://api.github.com/users/3PSY0N",
119+
"html_url": "https://github.com/3PSY0N",
120+
"followers_url": "https://api.github.com/users/3PSY0N/followers",
121+
"following_url": "https://api.github.com/users/3PSY0N/following{/other_user}",
122+
"gists_url": "https://api.github.com/users/3PSY0N/gists{/gist_id}",
123+
"starred_url": "https://api.github.com/users/3PSY0N/starred{/owner}{/repo}",
124+
"subscriptions_url": "https://api.github.com/users/3PSY0N/subscriptions",
125+
"organizations_url": "https://api.github.com/users/3PSY0N/orgs",
126+
"repos_url": "https://api.github.com/users/3PSY0N/repos",
127+
"events_url": "https://api.github.com/users/3PSY0N/events{/privacy}",
128+
"received_events_url": "https://api.github.com/users/3PSY0N/received_events",
129+
"type": "User",
130+
"site_admin": false
131+
},
132+
"labels": [
133+
{
134+
"id": 2540405642,
135+
"node_id": "MDU6TGFiZWwyNTQwNDA1NjQy",
136+
"url": "https://api.github.com/repos/symfony/ux/labels/good%20first%20issue",
137+
"name": "good first issue",
138+
"color": "7057ff",
139+
"default": true,
140+
"description": "Good for newcomers"
141+
},
142+
{
143+
"id": 6831689208,
144+
"node_id": "LA_kwDOEuCKh88AAAABlzNN-A",
145+
"url": "https://api.github.com/repos/symfony/ux/labels/Dropzone",
146+
"name": "Dropzone",
147+
"color": "dddddd",
148+
"default": false,
149+
"description": ""
150+
}
151+
],
152+
"state": "open",
153+
"locked": false,
154+
"assignee": null,
155+
"assignees": [
156+
157+
],
158+
"milestone": null,
159+
"comments": 5,
160+
"created_at": "2024-02-08T18:08:55Z",
161+
"updated_at": "2024-08-13T11:29:17Z",
162+
"closed_at": null,
163+
"author_association": "NONE",
164+
"active_lock_reason": null,
165+
"body": "Hello,\r\n\r\nWith symfony ux dropzone, you can drag and drop files to add them to the dropzone.\r\nOnce a file is in the zone (file A), if you want to replace it with another file (file B), drag'n'drop doesn't work: file A isn't replaced in the dropzone by file B.\r\nAnd file B opens in a new browser tab.\r\n\r\nIs this a known problem? How can I solve it, please?\r\n\r\n\r\nThanks\r\n\r\n![uxdropzone](https://github.com/symfony/ux/assets/78256817/f9ea1728-4f4b-4287-bcb9-22063b0b47d7)\r\n",
166+
"reactions": {
167+
"url": "https://api.github.com/repos/symfony/ux/issues/1480/reactions",
168+
"total_count": 0,
169+
"+1": 0,
170+
"-1": 0,
171+
"laugh": 0,
172+
"hooray": 0,
173+
"confused": 0,
174+
"heart": 0,
175+
"rocket": 0,
176+
"eyes": 0
177+
},
178+
"timeline_url": "https://api.github.com/repos/symfony/ux/issues/1480/timeline",
179+
"performed_via_github_app": null,
180+
"state_reason": null,
181+
"score": 1.0
182+
},
183+
{
184+
185+
}
186+
]
187+
```
188+
189+
After that, we just render a couple of static HTML pages.
190+
191+
To periodically cycle through issues (twice a day), we use [GitHub Workflow](https://docs.github.com/en/actions/using-workflows).
107192

108193
## Help us grow
109194

composer.lock

Lines changed: 25 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

generate.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,21 @@
88
use GoodFirstIssue\GitHubAPIClient;
99
use GuzzleHttp\Client;
1010

11+
$clients_config = [
12+
'base_uri' => 'https://api.github.com/',
13+
];
14+
1115
// Get GITHUB_TOKEN from env-variable
1216
$gh_token = getenv('GITHUB_TOKEN');
13-
if (! is_string($gh_token)) {
14-
throw new LogicException('Cannot read GITHUB_TOKEN env-variable');
17+
if (is_string($gh_token)) {
18+
$clients_config['headers'] = ['Authorization' => 'Bearer ' . $gh_token];
19+
print_r('Success: ENV-variable GITHUB_TOKEN was set.' . PHP_EOL );
20+
} else {
21+
print_r('Warning: ENV-variable GITHUB_TOKEN not found.' . PHP_EOL);
1522
}
1623

1724
// Init Guzzle client with headers
18-
$client = new Client([
19-
'base_uri' => 'https://api.github.com/',
20-
'headers' => ['Authorization' => 'Bearer ' . $gh_token]
21-
]);
25+
$client = new Client($clients_config);
2226

2327
$github_api_client = new GitHubAPIClient($client);
2428

repositories.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/DTO/Issue.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ public function __construct(
1010
public string $html_url,
1111
public string $title,
1212
public int $number,
13+
public int $comments,
14+
public string $user_avatar_url,
1315
public string $updated_at
1416
) {
1517
}

0 commit comments

Comments
 (0)