Skip to content

Commit

Permalink
docs: contributors update
Browse files Browse the repository at this point in the history
  • Loading branch information
devluizmarcolino committed Feb 5, 2025
1 parent 31bfb12 commit e189de5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 48 deletions.
60 changes: 13 additions & 47 deletions .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Contributors
name: Atualizar Contribuidores

on:
push:
Expand All @@ -7,54 +7,20 @@ on:
branches: [ main ]

jobs:
contributors:
atualizar-contribuidores:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Checkout repository
- name: Verificar repositório
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Generate contributors list
uses: actions/github-script@v6
- name: Obter contribuidores
uses: akhilmhdh/contributors-readme-action@v2.3.6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const contributors = await github.rest.repos.listContributors({
owner: context.repo.owner,
repo: context.repo.repo
});
const contributorsList = contributors.data
.filter(contributor => contributor.contributions > 0)
.map(contributor => `
<a href="https://github.com/${contributor.login}" target="_blank">
<img src="https://github.com/${contributor.login}.png" width="100" height="100" alt="${contributor.login}">
</a>`).join('\n');

const fs = require('fs');
const readmePath = './README.md';
let readmeContent = fs.readFileSync(readmePath, 'utf8');

const contributorsSection = `
## 👥 Contribuidores

Um agradecimento especial a todos que contribuíram para este projeto:

<div style="display: flex; flex-wrap: wrap; gap: 10px;">
${contributorsList}
</div>
`;
readmeContent = readmeContent.replace(/## 👥 Contribuidores[\s\S]*?(?=## 📘 Licença)/, contributorsSection);
fs.writeFileSync(readmePath, readmeContent);
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add README.md
git commit -m "Update contributors list" || exit 0
git push
image_size: 100
columns: 10
commit_message: "docs: atualizar contribuidores"
3 changes: 2 additions & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ Dê uma olhada no arquivo [CONTRIBUTING.md](./CONTRIBUTING.md) para mais detalhe
Um agradecimento especial a todos que contribuíram para este projeto:

<div style="display: flex; flex-wrap: wrap; gap: 10px;">

<!-- ALL-CONTRIBUTORS-LIST:START - Não remova ou modifique esta seção -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
</div>

---
Expand Down

0 comments on commit e189de5

Please sign in to comment.