Skip to content

Commit

Permalink
Take issues with good first issues labels from the GitHub API and s…
Browse files Browse the repository at this point in the history
…how them (#188)
  • Loading branch information
gomzyakov committed Aug 20, 2024
1 parent 52d9858 commit 0163132
Show file tree
Hide file tree
Showing 18 changed files with 347 additions and 768 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.4.0alpha4-alpine
FROM php:8.3.9-alpine

ENV COMPOSER_HOME="/tmp/composer"

Expand Down
129 changes: 107 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,35 +75,120 @@

# Good First Issues

**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.
**Good First Issues** helps you make your first contribution to open-source. Developers who've never contributed to open-source can get started quickly.

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

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

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.

## Adding a new project

You're welcome to add a new project in *Good First Issues*, just follow these steps:

- To maintain the quality of projects in *Good First Issues*, please make sure your GitHub repository meets the following criteria:

- It has at least three issues with the `good first issue` label. This label is already present on all repositories by default.

- It contains a `README.md` with detailed setup instructions for the project

- It is actively maintained (last update less than 1 month ago)

- 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).

- 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).

## How does it work?

- First *Good First Issues* is a static website that uses [PHP](https://www.php.net)` to generate HTML files.
- 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).
- To periodically cycle through issues (twice a day), we use [GitHub Workflow](https://docs.github.com/en/actions/using-workflows).
## How it works?

App send the request to GutHub API for each programming language:

```bash
curl -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"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"
```

And get the response with JSON-array with information about issues:

```json
[
{
"url": "https://api.github.com/repos/symfony/ux/issues/1480",
"repository_url": "https://api.github.com/repos/symfony/ux",
"labels_url": "https://api.github.com/repos/symfony/ux/issues/1480/labels{/name}",
"comments_url": "https://api.github.com/repos/symfony/ux/issues/1480/comments",
"events_url": "https://api.github.com/repos/symfony/ux/issues/1480/events",
"html_url": "https://github.com/symfony/ux/issues/1480",
"id": 2125792255,
"node_id": "I_kwDOEuCKh85-tQP_",
"number": 1480,
"title": "[UX Dropzone] drag'n'drop replacement fail",
"user": {
"login": "3PSY0N",
"id": 78256817,
"node_id": "MDQ6VXNlcjc4MjU2ODE3",
"avatar_url": "https://avatars.githubusercontent.com/u/78256817?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/3PSY0N",
"html_url": "https://github.com/3PSY0N",
"followers_url": "https://api.github.com/users/3PSY0N/followers",
"following_url": "https://api.github.com/users/3PSY0N/following{/other_user}",
"gists_url": "https://api.github.com/users/3PSY0N/gists{/gist_id}",
"starred_url": "https://api.github.com/users/3PSY0N/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/3PSY0N/subscriptions",
"organizations_url": "https://api.github.com/users/3PSY0N/orgs",
"repos_url": "https://api.github.com/users/3PSY0N/repos",
"events_url": "https://api.github.com/users/3PSY0N/events{/privacy}",
"received_events_url": "https://api.github.com/users/3PSY0N/received_events",
"type": "User",
"site_admin": false
},
"labels": [
{
"id": 2540405642,
"node_id": "MDU6TGFiZWwyNTQwNDA1NjQy",
"url": "https://api.github.com/repos/symfony/ux/labels/good%20first%20issue",
"name": "good first issue",
"color": "7057ff",
"default": true,
"description": "Good for newcomers"
},
{
"id": 6831689208,
"node_id": "LA_kwDOEuCKh88AAAABlzNN-A",
"url": "https://api.github.com/repos/symfony/ux/labels/Dropzone",
"name": "Dropzone",
"color": "dddddd",
"default": false,
"description": ""
}
],
"state": "open",
"locked": false,
"assignee": null,
"assignees": [

],
"milestone": null,
"comments": 5,
"created_at": "2024-02-08T18:08:55Z",
"updated_at": "2024-08-13T11:29:17Z",
"closed_at": null,
"author_association": "NONE",
"active_lock_reason": null,
"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",
"reactions": {
"url": "https://api.github.com/repos/symfony/ux/issues/1480/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"timeline_url": "https://api.github.com/repos/symfony/ux/issues/1480/timeline",
"performed_via_github_app": null,
"state_reason": null,
"score": 1.0
},
{

}
]
```

After that, we just render a couple of static HTML pages.

To periodically cycle through issues (twice a day), we use [GitHub Workflow](https://docs.github.com/en/actions/using-workflows).

## Help us grow

Expand Down
50 changes: 25 additions & 25 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 10 additions & 6 deletions generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@
use GoodFirstIssue\GitHubAPIClient;
use GuzzleHttp\Client;

$clients_config = [
'base_uri' => 'https://api.github.com/',
];

// Get GITHUB_TOKEN from env-variable
$gh_token = getenv('GITHUB_TOKEN');
if (! is_string($gh_token)) {
throw new LogicException('Cannot read GITHUB_TOKEN env-variable');
if (is_string($gh_token)) {
$clients_config['headers'] = ['Authorization' => 'Bearer ' . $gh_token];
print_r('Success: ENV-variable GITHUB_TOKEN was set.' . PHP_EOL );
} else {
print_r('Warning: ENV-variable GITHUB_TOKEN not found.' . PHP_EOL);
}

// Init Guzzle client with headers
$client = new Client([
'base_uri' => 'https://api.github.com/',
'headers' => ['Authorization' => 'Bearer ' . $gh_token]
]);
$client = new Client($clients_config);

$github_api_client = new GitHubAPIClient($client);

Expand Down
8 changes: 0 additions & 8 deletions repositories.json

This file was deleted.

2 changes: 2 additions & 0 deletions src/DTO/Issue.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public function __construct(
public string $html_url,
public string $title,
public int $number,
public int $comments,
public string $user_avatar_url,
public string $updated_at
) {
}
Expand Down
Loading

0 comments on commit 0163132

Please sign in to comment.