diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index b896fed..adf28b1 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -1,4 +1,4 @@ -name: Contributors +name: Atualizar Contribuidores on: push: @@ -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 => ` - - ${contributor.login} - `).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: - -
-${contributorsList} -
-`; - - 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 \ No newline at end of file + image_size: 100 + columns: 10 + commit_message: "docs: atualizar contribuidores" \ No newline at end of file diff --git a/README.MD b/README.MD index 16a4f9a..c3e1c0e 100644 --- a/README.MD +++ b/README.MD @@ -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:
- + +
---