-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: contribuidores adicionados no readme.md
- Loading branch information
1 parent
fc098f4
commit 31bfb12
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Contributors | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
contributors: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Generate contributors list | ||
uses: actions/github-script@v6 | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters