Skip to content

Update Contributors

Update Contributors #4

name: Update Contributors
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
jobs:
update-contributors:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Update Contributors
run: |
CONTRIBUTORS=$(curl -s https://api.github.com/repos/zakarialabib/mystockmaster/contributors | jq -r '.[].login')
sed -i '/## Contributors/q' README.md
# Start the table with a header
echo -e "## Contributors\n\n| Contributor | GitHub Profile |\n| --- | --- |" >> README.md
# Iterate through contributors and add them to the table
for contributor in $CONTRIBUTORS; do
contributor_url="https://github.com/$contributor"
contributor_avatar_url="https://github.com/$contributor.png?size=50" # Adjusted to 50x50
echo -e "| [$contributor]($contributor_url) | [![Avatar]($contributor_avatar_url)]($contributor_url) |" >> README.md
done
# Commit the changes
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add README.md
git commit -m "Update Contributors [skip ci]"
# Pull changes from the remote repository
git pull origin master --rebase
# Push the changes to the remote repository
git push origin HEAD:refs/heads/update-contributors
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
branch: update-contributors
commit-message: "Update Contributors in README"
title: "Update Contributors in README"