Skip to content

Update Contributors

Update Contributors #1

Workflow file for this run

name: Update Contributors
on:
schedule:
- cron: "0 0 * * *" # Executa diariamente à meia-noite UTC
workflow_dispatch: # Permite execução manual
jobs:
update-contributors:
runs-on: ubuntu-latest
steps:
- name: Checkout do repositório
uses: actions/checkout@v4
- name: Obter contribuintes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_NAME: "mri-Qbox-Brasil"
run: |
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/orgs/$ORG_NAME/repos?per_page=100" | jq -r '.[].name' > repos.txt
contributors=()
for repo in $(cat repos.txt); do
users=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$ORG_NAME/$repo/contributors?per_page=100" | jq -r '.[].login')
for user in $users; do
if [[ ! " ${contributors[@]} " =~ " $user " ]]; then
contributors+=($user)
fi
done
done
printf '%s\n' "${contributors[@]}" | jq -R . | jq -s . > contributors.json
- name: Commit e push
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git add contributors.json
git commit -m "Atualização da lista de contribuintes" || exit 0
git push