-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript
executable file
·39 lines (36 loc) · 1.32 KB
/
script
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
#!/bin/bash
if test $1 = "--PR"
then
echo "creando pull requests para modificar los repositorios"
activo="200"
else
echo "solo visitando los repositorios y registrando los estados"
activo="1000"
fi
echo "--$(date '+%F-%T')-[$activo]--------" >> check
echo "fecha,usuario,readme,repo,usuario">> check
cat usuarios.txt | while read line || [[ -n $line ]];
do
echo "https://github.com/$line/$line"
user_s=$(curl -s -o /dev/null -I -w "%{http_code}" "https://github.com/$line")
repo_s=$(curl -s -o /dev/null -I -w "%{http_code}" "https://github.com/$line/$line")
status=$(curl -s -o /dev/null -I -w "%{http_code}" "https://raw.githubusercontent.com/$line/$line/main/README.md")
echo $(date '+%F-%T'),$line,$status,$repo_s,$user_s >> check
if test $status -eq $activo
then
echo ">>>>OK $line"
gh repo fork --clone $line/$line
cd $line
echo "![Badge](https://bit.ly/icom-badge)" >> README.md
git add README.md
git commit -m "Agregado del badge de la carrera al perfil."
git push
gh pr create --title "Agregado automático del badge" --body "Este es un pull request automático para agregar el badge a su perfil en GitHub"
cd ..
echo "Estamos en: $(pwd)"
echo "gh repo delete martinvilu/$line --confirm" >> cleanup
else
echo $line >> reintento
fi
done
echo "--$(date '+%F-%T')---------" >> check