Merge pull request #151 from priyanshuverma-dev/feat-react-setup #58
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
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
contrib-readme-job: | ||
runs-on: ubuntu-latest | ||
name: A job to automate contrib in readme | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
width: | ||
fetch-depth: 0 | ||
- name: Contribute List | ||
uses: akhilmhdh/[email protected] | ||
with: | ||
image_size: 75 | ||
use_username: true | ||
columns_per_row: 10 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Enhance Contributors Section in README | ||
run: | | ||
cat > update_readme.py << 'EOF' | ||
import re | ||
def enhance_contributors_section(): | ||
with open('README.md', 'r') as f: | ||
content = f.read() | ||
# Pattern to identify and replace the contributors section | ||
pattern = r'(## Contributors\n\n)(.*?)(\n\n## |$)' | ||
replacement = ( | ||
"## Contributors\n\n" | ||
"<div align='center' style='border-radius: 15px; overflow: hidden; " | ||
"box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); margin: 10px;'>\n" | ||
" <a href='https://github.com/kom-senapati/bot-verse/graphs/contributors'>\n" | ||
" <img src='https://contrib.rocks/image?repo=kom-senapati/bot-verse&max=100' " | ||
"alt='Contributors' style='border-radius: 15px; max-width: 100%; height: auto;' />\n" | ||
" </a>\n" | ||
"</div>\n\n" | ||
) | ||
# Replace the existing contributors section with the enhanced layout | ||
new_content = re.sub(pattern, replacement, content, flags=re.DOTALL) | ||
with open('README.md', 'w') as f: | ||
f.write(new_content) | ||
if __name__ == "__main__": | ||
enhance_contributors_section() | ||
EOF | ||
python update_readme.py | ||
- 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 diff --staged --quiet || (git commit -m "Enhanced contributors section" && git push) |