Skip to content
Open
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
40 changes: 20 additions & 20 deletions .github/workflows/get_repo_metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
uses: actions/checkout@v4

- name: Generate JSON File with Repo Data Metric
run: |
run: |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run: |
run: |

echo "### Count: Stargazer###"
gh repo view DesignLiquido/delegua --json stargazerCount > stargazerCount.json

Expand All @@ -23,7 +23,7 @@ jobs:
gh release view --repo DesignLiquido/delegua --json name,tagName,publishedAt,url > lastReleaseData.json

echo "### Contributors Count ###"
gh api repos/DesignLiquido/delegua/contributors --paginate | jq length > contriburosCount.json
gh api repos/DesignLiquido/delegua/contributors --paginate | jq length > contributorsCount.json

echo "### Issues Count - OPEN ###"
gh api 'search/issues?q=repo:DesignLiquido/delegua+is:issue+is:open' --jq '.total_count' > openIssuesCount.json
Expand All @@ -45,67 +45,67 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload stargazerCount.json
uses: actions/upload-artifact@v4
uses: ./files/actions/upload-artifact@v4
with:
name: stargazerCount
path: stargazerCount.json
path: ./files/stargazerCount.json

- name: Upload watchersCount.json
uses: actions/upload-artifact@v4
uses: ./files/actions/upload-artifact@v4
with:
name: watchersCount
path: watchersCount.json
path: ./files/watchersCount.json

- name: Upload forkCount.json
uses: actions/upload-artifact@v4
uses: ./files/actions/upload-artifact@v4
with:
name: forkCount
path: forkCount.json
path: ./files/forkCount.json

- name: Upload lastReleaseData.json
uses: actions/upload-artifact@v4
uses: ./files/actions/upload-artifact@v4
with:
name: lastReleaseData
path: lastReleaseData.json
path: ./files/lastReleaseData.json

- name: Upload contriburosCount.json
- name: Upload contributorsCount.json
uses: actions/upload-artifact@v4
with:
name: contriburosCount
path: contriburosCount.json
name: contributorsCount
path: ./files/contributorsCount.json

- name: Upload openIssuesCount.json
uses: actions/upload-artifact@v4
with:
name: openIssuesCount
path: openIssuesCount.json
path: ./files/openIssuesCount.json

- name: Upload closedIssuesCount.json
uses: actions/upload-artifact@v4
with:
name: closedIssuesCount
path: closedIssuesCount.json
path: ./files/closedIssuesCount.json

- name: Upload openPRsCount.json
uses: actions/upload-artifact@v4
with:
name: openPRsCount
path: openPRsCount.json
path: ./files/openPRsCount.json

- name: Upload closedPRsCount.json
uses: actions/upload-artifact@v4
with:
name: closedPRsCount
path: closedPRsCount.json
path: ./files/closedPRsCount.json

- name: Upload communityStandards.json
uses: actions/upload-artifact@v4
with:
name: communityStandards
path: communityStandards.json

path: ./files/communityStandards.json
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

- name: Upload security.json
uses: actions/upload-artifact@v4
with:
name: security
path: security.json
path: ./files/security.json
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</picture>
</div>

# <nome-do-repositório>
# Repo Health Check

[English Version](/README_EN.md)

Expand Down Expand Up @@ -47,13 +47,13 @@ Certifique-se de ler esses arquivos com atenção antes de contribuir. Se tiver

## ❤️ Quem já Contribuiu

<a href="https://github.com/cumbucadev/generic-template/graphs/contributors">
<img src="https://contrib.rocks/image?repo=cumbucadev/generic-template" />
<a href="https://github.com/cumbucadev/repo-health-check/graphs/contributors">
<img src="https://contrib.rocks/image?repo=cumbucadev/repo-health-check" />
</a></br></br>

_Made with [contrib.rocks](https://contrib.rocks)._

[github-discussions-doc]: https://docs.github.com/pt/discussions
[github-discussions]: https://github.com/cumbucadev/<nome-do-repositório>/discussions
[github-discussions]: https://github.com/cumbucadev/repo-health-check/discussions
[github-issues-doc]: https://docs.github.com/pt/issues/tracking-your-work-with-issues/creating-an-issue
[github-issues]: https://github.com/cumbucadev/<nome-do-repositório>/issues
[github-issues]: https://github.com/cumbucadev/repo-health-check/issues
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__pycache__ directories can be safely added to .gitignore. They contain compiled Python bytecode files (.pyc) that are automatically generated by Python to speed up execution, so they don’t need to be versioned. Keeping them out of the repo helps reduce noise in diffs and avoids unnecessary files being tracked.

To ignore them, you can add this to .gitignore:

__pycache__/
*.py[cod]

Binary file not shown.
Binary file added scripts/__pycache__/load_json.cpython-312.pyc
Binary file not shown.
Binary file added scripts/__pycache__/write_csv.cpython-312.pyc
Binary file not shown.
70 changes: 70 additions & 0 deletions scripts/build_repo_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
def build_repo_data(data_list):

""" Extract the wanted values from a list into a dict """

stars_count = data_list[0]['stargazerCount'] #00 Stars Count
watchers_count = data_list[1]['watchers']['totalCount'] #01 Watchers Count
fork_count = data_list[2]['forkCount'] #02 Fork Count
last_release_name = data_list[3]['name'] #03 Last Release: NAME
last_release_date = data_list[3]['publishedAt'] #04 Last Release: DATE
contributors_count = data_list[4] #05 Contributors Count
open_issues_count = data_list[5] #06 Open Issues Count
closed_issues_count = data_list[6] #07 Closed Issues Count
open_prs_count = data_list[7] #08 Open PRs Count
closed_prs_count = data_list[8] #09 Closed PRs Count

has_description = bool ( #10 Returns 'True' if the repo has description
data_list[9].get('description')
)

has_readme = bool ( #11 Returns 'True' if the repo has description
(data_list[9].get('files') or {}).get('readme')
)

has_code_of_conduct = bool( #12 Returns 'True' if the repo has code of conduct
(data_list[9].get('files' or {})).get('code_of_conduct')
)

has_contributing = bool( #13 Returns 'True' if the repo has contributing file
(data_list[9].get('files') or {}).get('contributing', {}). get('url')
)

has_license = bool( #14 Returns 'True' if the repo has license
(data_list[9].get('files') or {}).get('license', {}).get('name')
)

has_issues_templates = bool( #15 Returns 'True' if the repo has issues templates
(data_list[9].get('files') or {}).get('issue_template')
)

has_pr_template = bool( #16 Returns 'True' if the repo has PR template
(data_list[9].get('files') or {}).get('pull_request_template')
)

has_content_reports_enabled = bool( #17 Returns 'True' if the repo had content reports enabled
data_list[9].get('content_reports_enabled')
)

has_security_policy = data_list[10].get('isSecurityPolicyEnabled') #18 Returns the value in 'isSecurityPolicyEnabled'

return {
'stars_count': stars_count,
'watchers_count': watchers_count,
'fork_count': fork_count,
'last_release_name': last_release_name,
'last_release_date': last_release_date,
'contributors_count': contributors_count,
'open_issues_count': open_issues_count,
'closed_issues_count': closed_issues_count,
'open_prs_count': open_prs_count,
'closed_prs_count': closed_prs_count,
'has_description': has_description,
'has_readme': has_readme,
'has_code_of_conduct': has_code_of_conduct,
'has_contributing': has_contributing,
'has_license': has_license,
'has_issues_templates': has_issues_templates,
'has_pr_template': has_pr_template,
'has_content_reports_enabled': has_content_reports_enabled,
'has_security_policy': has_security_policy
}
74 changes: 74 additions & 0 deletions scripts/load_json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import json

def load_json(*filepathes):
""" This function returns a dict list with data collected from the github repository """
data = []

# Star count
with open(filepathes[0], 'r') as star_count_json:
star_count_data = json.load(star_count_json)
# print(type(star_count_data))
# print('Star count: ', star_count_data,'\n')
data.append(star_count_data)

# Watchers count
with open(filepathes[1], 'r') as watchers_count_json:
watchers_count_data = json.load(watchers_count_json)
# print('Watchers count: ', watchers_count_data,'\n')
data.append(watchers_count_data)

# Fork count
with open(filepathes[2], 'r') as fork_count_json:
fork_count_data = json.load(fork_count_json)
# print('Fork count: ', fork_count_data)
data.append(fork_count_data)

# Last Release
with open(filepathes[3], 'r') as last_release_json:
last_release_data = json.load(last_release_json)
# print('Last release: ', last_release_data)
data.append(last_release_data)

# Contributors Count
with open(filepathes[4], 'r') as contributors_count_json:
contributors_count = json.load(contributors_count_json)
# print('Conbributors count: ', contributors_count)
data.append(contributors_count)

# Open Issues
with open (filepathes[5], 'r') as open_issues_count_json:
open_issues_count = json.load(open_issues_count_json)
# print('Open ISSUES: ', open_issues_count)
data.append(open_issues_count)

# Closed Issues
with open(filepathes[6], 'r') as closed_issues_count_json:
closed_issues_count = json.load(closed_issues_count_json)
# print('Closed ISSUES: ', closed_issues_count)
data.append(closed_issues_count)

# Open PRs Count
with open(filepathes[7], 'r') as open_prs_count_json:
open_prs_count = json.load(open_prs_count_json)
# print('Open PRs: ', open_prs_count)
data.append(open_prs_count)

# Closed PRs Count
with open(filepathes[8], 'r') as closed_prs_count_json:
closed_prs_count = json.load(closed_prs_count_json)
# print('Closed PRs: ', closed_prs_count)
data.append(closed_prs_count)

# Community Standards
with open(filepathes[9], 'r') as community_standards_json:
community_standards_data = json.load(community_standards_json)
# print('Community Standards: ', community_standards_data)
data.append(community_standards_data)

# Security Data
with open(filepathes[10], 'r') as security_json:
security_data = json.load(security_json)
# print('Security enabled: ', security_data)
data.append(security_data)

return data
35 changes: 35 additions & 0 deletions scripts/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from load_json import load_json
from build_repo_data import build_repo_data
from write_csv import write_csv

STAR_COUNT_FILE = './files/stargazerCount.json'
WATCHERS_COUNT_FILE = './files/watchersCount.json'
FORK_COUNT_FILE = './files/forkCount.json'
LAST_RELEASE_FILE = './files/lastReleaseData.json'
CONTRIBUTORS_COUNT_FILE = './files/contributorsCount.json'
OPEN_ISSUES_COUNT_FILE = './files/openIssuesCount.json'
CLOSED_ISSUES_COUNT_FILE = './files/closedIssuesCount.json'
OPEN_PRS_COUNT_FILE = './files/openPRsCount.json'
CLOSED_PRS_COUNT_FILE = './files/closedPRsCount.json'
COMMUNITY_STANDARDS_FILE = './files/communityStandards.json'
SECURITY_FILE = './files/security.json'

OUTPUT_FILE = "repo_health_data.csv"

data_from_json = load_json(
STAR_COUNT_FILE,
WATCHERS_COUNT_FILE,
FORK_COUNT_FILE,
LAST_RELEASE_FILE,
CONTRIBUTORS_COUNT_FILE,
OPEN_ISSUES_COUNT_FILE,
CLOSED_ISSUES_COUNT_FILE,
OPEN_PRS_COUNT_FILE,
CLOSED_PRS_COUNT_FILE,
COMMUNITY_STANDARDS_FILE,
SECURITY_FILE,
)

data_into_dict = build_repo_data(data_from_json)

write_csv(data_into_dict, file_name=OUTPUT_FILE)
30 changes: 30 additions & 0 deletions scripts/write_csv.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import csv

def write_csv(data_dict, file_name):

repo_data_dict = {
'stars_count': data_dict['stars_count'],
'watchers_count': data_dict['watchers_count'],
'fork_count': data_dict['fork_count'],
'last_release_name': data_dict['last_release_name'],
'last_release_date': data_dict['last_release_date'],
'contributors_count': data_dict['contributors_count'],
'open_issues_count': data_dict['open_issues_count'],
'closed_issues_count': data_dict['closed_issues_count'],
'open_prs_count': data_dict['open_prs_count'],
'closed_prs_count': data_dict['closed_prs_count'],
'community_standards_description': data_dict['has_description'],
'community_standards_readme': data_dict['has_readme'],
'community_standards_code_of_conduct': data_dict['has_code_of_conduct'],
'community_standards_contributing': data_dict['has_contributing'],
'community_standards_license': data_dict['has_license'],
'community_standards_issues_templates': data_dict['has_issues_templates'],
'community_standards_pr_template': data_dict['has_pr_template'],
'community_standards_content_reports_enabled': data_dict['has_content_reports_enabled'],
'community_standards_security_policy': data_dict['has_security_policy']
}

with open(file_name, "w", newline="", encoding="utf-8") as repo_health_data:
writer = csv.DictWriter(repo_health_data, fieldnames=repo_data_dict.keys())
writer.writeheader()
writer.writerow(repo_data_dict)
Loading