Skip to content

Commit e76f8fc

Browse files
authored
Merge pull request #4 from bambadiagne/feat/most_used_technos
Feat: add most used technos in senegal
2 parents f71f181 + f7c8931 commit e76f8fc

File tree

7 files changed

+24656
-843
lines changed

7 files changed

+24656
-843
lines changed

.github/workflows/update_data.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: Update users.json data every 2 hours
1+
name: Update users.json data every Monday at midnight UTC
22

33
on:
44
schedule:
5-
- cron: '0 */8 * * *'
5+
- cron: '0 0 * * 1'
66
workflow_dispatch:
77
jobs:
88
update_data:
99
runs-on: ubuntu-latest
1010
permissions:
1111
contents: write
1212
env:
13-
GITHUB_TOKEN: ${{ secrets.SECRET_GITHUB_TOKEN }}
13+
TOKENS: ${{ secrets.TOKENS }}
1414
steps:
1515
- uses: actions/checkout@v4
1616
with:
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Update technos_stats.json data 3 times on the same day each week (90min apart)
2+
3+
on:
4+
schedule:
5+
# Example: Every Monday at 00:00, 01:30, and 03:00 UTC
6+
- cron: '0 0 * * 2'
7+
- cron: '30 1 * * 2'
8+
- cron: '0 3 * * 2'
9+
workflow_dispatch:
10+
11+
jobs:
12+
update_data:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
env:
17+
TOKENS: ${{ secrets.TOKENS }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
ref: ${{ github.head_ref }}
22+
- uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.10'
25+
26+
- name: Install dependencies
27+
run: pip install -r requirements.txt
28+
29+
- name: Run Python script
30+
run: python -c "from query import get_all_senegalese_technos; get_all_senegalese_technos()"
31+
continue-on-error: true
32+
33+
- name: Auto commit changes
34+
uses: stefanzweifel/git-auto-commit-action@v4
35+
with:
36+
commit_message: "Update technos_stats.json data n° ${{ github.run_number }}"
37+
commit_user_name: "github-actions[bot]"
38+
commit_user_email: "github-actions[bot]@users.noreply.github.com"
39+
file_pattern: '*.json'
40+
push_options: '--force'
41+
skip_fetch: true
42+
branch: ${{ github.head_ref }}

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ python3 app.py
2929

3030
```bash
3131
docker build . -t flask-graphql-github
32-
docker run -e GITHUB_TOKEN=YOUR_TOKEN -e FLASK_DEBUG=1 -dp 5000:5000 flask-graphql-github
32+
docker run -e TOKENS=YOUR_TOKENS -e FLASK_DEBUG=1 -v ".:/app" -dp 5000:5000 flask-graphql-github
3333
```
34-
3534
## Usage
3635

3736
<br><b>With this tool, you will be able to know for example who uses a certain language (go, python, java,...), retrieve all users from a location for your dataset for example, it can also help recruiters...</b>
@@ -149,39 +148,41 @@ If you want to fetch more,you must add the _after_ field
149148
```bash
150149
GET /users/bambadiagne
151150
{
152-
"avatarUrl": "https://avatars.githubusercontent.com/u/45278724?u=8d5129d655e9eafebcd725944bf401ca0ba93feb&v=4",
153-
"bio": "Full-stack Developper Python-JS | Devops Enthusiast | CTF player",
151+
"avatarUrl": "https://avatars.githubusercontent.com/u/45278724?u=0232c17904211491a7d30eb1b1b7897a6f99ffc1&v=4",
152+
"bio": "Full-stack Developper | Devops & Cloud Enthusiast | AWS certified ",
154153
"contributionsCollection": {
155154
"contributionCalendar": {
156-
"totalContributions": 359
155+
"totalContributions": 716
157156
},
158-
"restrictedContributionsCount": 0,
159-
"totalCommitContributions": 293
157+
"restrictedContributionsCount": 74,
158+
"totalCommitContributions": 608
160159
},
161160
"email": "diagne.bambahmadou@gmail.com",
162161
"location": "Senegal,Dakar",
163162
"login": "bambadiagne",
164163
"most_starred_repo": {
165-
"forkCount": 0,
164+
"forkCount": 4,
166165
"name": "github-user-stats",
167-
"stargazerCount": 9
166+
"stargazerCount": 26
168167
},
169168
"most_used_languages": [
170169
"JavaScript",
171170
"HTML",
172171
"CSS",
173-
"Java",
174-
"Python"
172+
"Python",
173+
"TypeScript"
175174
],
176175
"name": "Ahmadou Bamba Diagne",
177-
"twitterUsername": "AhmadouElkha",
178-
"websiteUrl": "https://ahmadoubambadiagne.tech/"
176+
"twitterUsername": "Elkha_D",
177+
"websiteUrl": "https://bambadiagne.github.io/"
179178
}
180179
```
181180
# Authors
182181
<a href="https://github.com/bambadiagne/github-user-stats/graphs/contributors">
183182
<img src="https://contributors-img.web.app/image?repo=bambadiagne/github-user-stats" />
184183
</a>
184+
<br>
185+
Thanks to [daoodaba975](https://github.com/daoodaba975/galsenify) for providing Senegalese locations.
185186

186187
## Contributing
187188

app.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,47 @@
44
from flask_apscheduler import APScheduler
55
from flask_cors import CORS
66
import os
7-
87
app = Flask(__name__)
98
CORS(app)
109
scheduler = APScheduler()
1110
scheduler.init_app(app)
1211
scheduler.start()
1312

14-
1513
@scheduler.task('interval', id='do_fetch_senegal_users',
1614
seconds=3600, misfire_grace_time=900)
1715
def get_senegal_users():
1816
get_all_senegalese_users()
1917

20-
18+
@app.route('/technos', methods=['GET'])
19+
def fetch_technos():
20+
json_file = open('techno_stats.json', 'r')
21+
data = json.loads(json_file.read())
22+
techno_types = ['backend', 'frontend', 'mobile']
23+
final_data={
24+
'technos_repartition':{},
25+
'technos_types':{},
26+
'total_repos':0
27+
}
28+
for user in data:
29+
for t in techno_types:
30+
if t in user.get('technologies', {}):
31+
for techno, count in user['technologies'][t].items():
32+
final_data['technos_types'][t] = final_data['technos_types'].get(t, 0) + count
33+
final_data['technos_repartition'][techno]=final_data['technos_repartition'].get(techno,0) + count
34+
final_data['total_repos']+=user['repos_analyzed']
35+
symfony_group = 0
36+
to_remove = []
37+
# Symfony group packages
38+
for techno in final_data['technos_repartition']:
39+
if 'symfony' in techno.lower():
40+
symfony_group += final_data['technos_repartition'][techno]
41+
to_remove.append(techno)
42+
for techno in to_remove:
43+
del final_data['technos_repartition'][techno]
44+
if symfony_group > 0:
45+
final_data['technos_repartition']['symfony'] = symfony_group
46+
return jsonify(final_data)
47+
2148
@app.route('/users/contributions/senegal', methods=['GET'])
2249
def fetch_senegal_users():
2350
json_file = open('users.json', 'r')

0 commit comments

Comments
 (0)