chore: adjust packages #19
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
name: Update README with Contributors | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
update-readme: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get last commit author | |
id: get-author | |
run: echo "AUTHOR=$(git log -1 --pretty=format:'%an')" >> $GITHUB_ENV | |
- name: Get last commit author's GitHub username | |
id: get-username | |
run: echo "USERNAME=$(git log -1 --pretty=format:'%ae' | cut -d'@' -f1)" >> $GITHUB_ENV | |
- name: Add contributor to README | |
run: | | |
if ! grep -q "${{ env.USERNAME }}" README.md; then | |
echo "Adding new contributor: ${{ env.AUTHOR }}" | |
echo " <a href='https://github.com/${{ env.USERNAME }}'><img src='https://github.com/${{ env.USERNAME }}.png' height='50px' /></a>" >> README.md | |
fi | |
- name: Commit and push changes | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add README.md | |
git commit -m "Auto-update README with new contributor: ${{ env.AUTHOR }}" || exit 0 | |
git push |