How many issue comments have I posted? #19

Closed
opened 2025-11-25 00:10:31 +01:00 by Benjamin_Loison · 5 comments

It is easy to see the number of issues with https://codeberg.org/issues.

https://blog.codeberg.org/letter-from-codeberg-onwards-and-upwards.html

more than 300k repositories

So I am 606 / 300,000, that is 1 / 495 of Codeberg repositories are mine.

Related to #1 and #13.

It is easy to see the number of issues with https://codeberg.org/issues. https://blog.codeberg.org/letter-from-codeberg-onwards-and-upwards.html > more than 300k repositories So I am 606 / 300,000, that is 1 / 495 of Codeberg repositories are mine. Related to #1 and #13.
Author
Owner

I verified that on repository with single issue with no comment (Benjamin_Loison/flathub-infra_website), listing comments does not return anything, but it works fine otherwise (Benjamin_Loison/android).

I verified that on repository with single issue with no comment ([Benjamin_Loison/flathub-infra_website](https://codeberg.org/Benjamin_Loison/flathub-infra_website)), listing comments does not return anything, but it works fine otherwise ([Benjamin_Loison/android](https://codeberg.org/Benjamin_Loison/android)).
Author
Owner
Python script:
import requests
from tqdm import tqdm

# *Repository and Organization Access*: *All (public, private, and limited)*
# *Selection permissions*:
# - *issue*: *Read*
# - *repository*: *Read*
# - *user*: *Read*
TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'

HEADERS = {
    'Authorization': f'token {TOKEN}'
}

def getApi(url, params):
    return requests.get(f'https://codeberg.org/api/v1/{url}', params, headers = HEADERS).json()

def getItems(url, params):
    items = []
    with tqdm() as progressBar:
        while True:
            params['page'] = progressBar.n + 1
            data = getApi(url, params)
            items += data
            dataLen = len(data)
            if ('limit' in params and dataLen < params['limit']) or data == []:
                break
            progressBar.update(1)
    return items

PARAMS = {
    'limit': 50,
}

repos = getItems('user/repos', PARAMS)

totalIssueComments = 0
for repo in tqdm(repos, 'repo'):
    repoFullName = repo['full_name']
    comments = getItems(f'repos/{repoFullName}/issues/comments', {})
    totalIssueComments += len(comments)
    print(f'{totalIssueComments=}')
Output:
...
totalIssueComments=16751
repo: 100%|██████████| 610/610 [05:33<00:00,  1.83it/s]
<details> <summary>Python script:</summary> ```python import requests from tqdm import tqdm # *Repository and Organization Access*: *All (public, private, and limited)* # *Selection permissions*: # - *issue*: *Read* # - *repository*: *Read* # - *user*: *Read* TOKEN = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' HEADERS = { 'Authorization': f'token {TOKEN}' } def getApi(url, params): return requests.get(f'https://codeberg.org/api/v1/{url}', params, headers = HEADERS).json() def getItems(url, params): items = [] with tqdm() as progressBar: while True: params['page'] = progressBar.n + 1 data = getApi(url, params) items += data dataLen = len(data) if ('limit' in params and dataLen < params['limit']) or data == []: break progressBar.update(1) return items PARAMS = { 'limit': 50, } repos = getItems('user/repos', PARAMS) totalIssueComments = 0 for repo in tqdm(repos, 'repo'): repoFullName = repo['full_name'] comments = getItems(f'repos/{repoFullName}/issues/comments', {}) totalIssueComments += len(comments) print(f'{totalIssueComments=}') ``` </details> <details> <summary>Output:</summary> ``` ... totalIssueComments=16751 repo: 100%|██████████| 610/610 [05:33<00:00, 1.83it/s] ``` </details>
Author
Owner

Let us consider my last issue comment Benjamin_Loison/server/issues/9#issuecomment-8456772.

16,751 / 8,456,772 = 1 / 504.9 of Codeberg issue comments are mine.

Benjamin_Loison/server/issues/9#issue-1089225

1,089,225 issues, so I am 7,474 + 455 = 7,929 of them, that is I am 1 / 137 of Codeberg issues.

Related to Benjamin-Loison/gitea/issues/57.

Let us consider my last issue comment [Benjamin_Loison/server/issues/9#issuecomment-8456772](https://codeberg.org/Benjamin_Loison/server/issues/9#issuecomment-8456772). 16,751 / 8,456,772 = 1 / 504.9 of Codeberg issue comments are mine. [Benjamin_Loison/server/issues/9#issue-1089225](https://codeberg.org/Benjamin_Loison/server/issues/9#issue-1089225) 1,089,225 issues, so I am 7,474 + 455 = 7,929 of them, that is I am 1 / 137 of Codeberg issues. Related to [Benjamin-Loison/gitea/issues/57](https://github.com/Benjamin-Loison/gitea/issues/57).
Author
Owner

In a nutshell:

On Codeberg:

  • 1 repository over 495
  • 1 issue over 137
  • 1 issue comment over 505

belong to me.

In a nutshell: On Codeberg: - 1 repository over 495 - 1 issue over 137 - 1 issue comment over 505 belong to me.
Author
Owner
Related to [Benjamin-Loison/gitea/issues/46](https://github.com/Benjamin-Loison/gitea/issues/46).
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Benjamin_Loison/codeberg#19