Skip to content

Commit

Permalink
Update auto script and stars format (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
tungbq authored May 25, 2024
1 parent 04c7f4f commit a95a5e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/generate_content.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,17 @@ jobs:
# Read and write permissions
# Allow GitHub Actions to create and approve pull requests
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Update table of content'
commit-message: 'Automated update table of content'
committer: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
author: '${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>'
signoff: false
branch: update-content
branch-suffix: timestamp
delete-branch: true
base: 'main'
title: 'Update table of content'
title: '[Automated] Update table of content'
body: |
Update table of content
[Automated] Update table of content
- Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
Expand Down
27 changes: 6 additions & 21 deletions generate_content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,17 @@ generate_repo_table() {
# Only get base repo name, execlude the username
repo_base_name=$(basename $repo_name)

local repo_hyperlink="<a href=\"https://github.com/$repo_name\">$repo_name</a>"
local stars="<a href=\"https://github.com/$repo_name/stargazers\"><img alt=\"GitHub Repo stars\" src=\"https://img.shields.io/github/stars/$repo_name?style=social\"/></a>"
local repo_hyperlink="<a href=\"https://github.com/$repo_name\">$repo_base_name</a>"
local stars="<a href=\"https://github.com/$repo_name/stargazers\"><img alt=\"GitHub Repo stars\" src=\"https://img.shields.io/github/stars/$repo_name?style=flat\"/></a>"

# At header in the first run
if [[ "$index" == "1" ]]; then
# Start HTML table
echo "<table>" >>README.md
echo " <tr>" >>README.md
echo " <th>Repo URL</th>" >>README.md
echo " <th>Stars</th>" >>README.md
echo " <th>Description</th>" >>README.md
echo " </tr>" >>README.md
echo "" >> README.md
echo "| ID | URL | Description | Stars |" >> README.md
echo "| :-- | :--------------- | :--------------------------------------------- | :------ |" >> README.md
fi

echo " <tr>" >>README.md
echo " <th>$repo_hyperlink</th>" >>README.md
echo " <th>$stars</th>" >>README.md
echo " <th>$description</th>" >>README.md
echo " </tr>" >>README.md

echo "| $index | $repo_hyperlink | $description | $stars |" >> README.md
}

# Start README file with header
Expand Down Expand Up @@ -95,11 +86,5 @@ while IFS= read -r repo_name; do
((index++))
done <"$REPOSITORY_LIST"

## Table closing
if [[ "$MODE" == "table" ]]; then
# End HTML table
echo "</table>" >>README.md
fi

echo "" >>README.md
echo "For full list of repositories, click [**here**](https://github.com/${GITHUB_OWNER}?tab=repositories&q=&type=&language=&sort=stargazers)." >>README.md

0 comments on commit a95a5e7

Please sign in to comment.