-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-github-api.html
More file actions
89 lines (75 loc) · 3.5 KB
/
Copy pathtest-github-api.html
File metadata and controls
89 lines (75 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html>
<head>
<title>Atualizar Repositórios GitHub</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; }
button { padding: 10px 20px; background: #0969da; color: white; border: none; border-radius: 5px; cursor: pointer; }
#result { margin-top: 20px; padding: 15px; background: #f6f8fa; border-radius: 5px; white-space: pre-wrap; font-family: monospace; }
</style>
</head>
<body>
<h1>🔄 Atualizar Repositórios do GitHub</h1>
<button onclick="updateRepos()">Buscar Repositórios</button>
<div id="result"></div>
<script>
async function updateRepos() {
const result = document.getElementById('result');
result.textContent = '🔍 Buscando repositórios...';
try {
const response = await fetch('https://api.github.com/users/lukasdevjobs1/repos?per_page=100');
const repos = await response.json();
console.log('Repositórios encontrados:', repos);
const repoData = repos.map(repo => ({
name: repo.name,
description: repo.description || 'Sem descrição',
language: repo.language || 'N/A',
stars: repo.stargazers_count,
forks: repo.forks_count,
url: repo.html_url,
fork: repo.fork,
created: new Date(repo.created_at).getFullYear(),
updated: new Date(repo.updated_at).toLocaleDateString('pt-BR')
}));
const originals = repoData.filter(repo => !repo.fork);
const forks = repoData.filter(repo => repo.fork);
let context = `## PORTFÓLIO COMPLETO (${repos.length} repositórios):
### PROJETOS ORIGINAIS (${originals.length}):
`;
originals.forEach((repo, index) => {
const stars = repo.stars > 0 ? ` - ${repo.stars} star${repo.stars > 1 ? 's' : ''} ⭐` : '';
const forksText = repo.forks > 0 ? ` ${repo.forks} fork${repo.forks > 1 ? 's' : ''} 🍴` : '';
context += `${index + 1}. **${repo.name}** (${repo.language})${stars}${forksText}
- ${repo.description}
- Criado: ${repo.created}
- URL: ${repo.url}
`;
});
if (forks.length > 0) {
context += `### PROJETOS ESTUDADOS (${forks.length} Forks):
`;
forks.forEach(repo => {
context += `- **${repo.name}** (${repo.language}) - ${repo.description}
`;
});
}
const languages = [...new Set(repos.map(r => r.language).filter(l => l))];
context += `
## TECNOLOGIAS UTILIZADAS:
${languages.map(lang => `- ${lang}`).join('\n')}
## ESTATÍSTICAS:
- Total de repositórios: ${repos.length}
- Projetos originais: ${originals.length}
- Projetos estudados (forks): ${forks.length}
- Total de stars: ${originals.reduce((sum, repo) => sum + repo.stars, 0)}
- Linguagens diferentes: ${languages.length}
`;
result.textContent = `✅ Encontrados ${repos.length} repositórios!\n\n${context}`;
} catch (error) {
result.textContent = `❌ Erro: ${error.message}`;
console.error('Erro:', error);
}
}
</script>
</body>
</html>