Skip to content

Commit

Permalink
ci: improve generate content workflow (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
tungbq authored May 18, 2024
1 parent c2c1109 commit 08e3c7a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/generate_content.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,17 @@ jobs:
uses: actions/checkout@v4

- name: Generate content
run: ./generate_content.sh repository_list.txt
run: |
echo "Repo owner: ${{ github.repository_owner }}"
./generate_content.sh repository_list.txt ${{ github.repository_owner }}
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
# Goto: Repo > Setting > Action > General > Workflow permission, enable following options:
# Read and write permissions
# Allow GitHub Actions to create and approve pull requests
# Read and write permissions
# Allow GitHub Actions to create and approve pull requests
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Update table of content'
committer: 'github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>'
Expand Down
9 changes: 6 additions & 3 deletions generate_content.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

REPOSITORY_LIST=$1

if [ -z $REPOSITORY_LIST ]; then
# User input, or will be automated detected via CI
GITHUB_OWNER=$2

if [ -z $REPOSITORY_LIST || ]; then
echo "ERROR: epository list is empty!"
echo "Usage: $0 <repository_list_path>"
echo "Usage: $0 <repository_list_path> <github_owner>"
exit 1
fi

Expand Down Expand Up @@ -56,4 +59,4 @@ while IFS= read -r repo_name; do
done <"$REPOSITORY_LIST"

echo "" >>README.md
echo "For full list of repositories, click [**here**](https://github.com/tungbq?tab=repositories&q=&type=&language=&sort=stargazers)." >>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 08e3c7a

Please sign in to comment.