Skip to content

Commit

Permalink
Merge pull request #18 from hmasdev/feat-automatically-update-readme
Browse files Browse the repository at this point in the history
Automatically update README.md with GitHub Actions
  • Loading branch information
hmasdev authored Sep 5, 2024
2 parents 7383fee + 8cf59ad commit d8da96a
Show file tree
Hide file tree
Showing 7 changed files with 436 additions and 8 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/automatically-update-readme.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Automatically update README

on:
workflow_dispatch:
schedule:
- cron: "0 0 1 * *"

env:
BRANCH_HEADER: "bot/update-readme-"

jobs:
update-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -e .[dev]
- name: Run script
run: |
python update_readme.py > README.md
- name: Check if README.md has changed
id: check_changes
run: |
if [[ -n $(git status --porcelain README.md) ]]; then
echo "README.md has changed."
echo "changes_detected=true" >> "$GITHUB_ENV"
else
echo "README.md has not changed."
echo "changes_detected=false" >> "$GITHUB_ENV"
fi
- name: Commit changes
if: env.changes_detected == 'true'
run: |
git checkout -b ${BRANCH_HEADER}${{ github.run_id }}
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "Update README.md"
- name: Push changes
if: env.changes_detected == 'true'
run: git push -u origin ${BRANCH_HEADER}${{ github.run_id }}
- name: Create pull request
if: env.changes_detected == 'true'
run: |
gh pr create \
--title "Update README.md" \
--body "This PR updates the README.md file." \
--base main \
--head ${BRANCH_HEADER}${{ github.run_id }} \
--reviewer hmasdev \
--assignee hmasdev \
--label "bot"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Werewolf Game with `autogen`
# :wolf: Werewolf Game with `autogen`

![GitHub top language](https://img.shields.io/github/languages/top/hmasdev/autogen-werewolf)
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/hmasdev/autogen-werewolf?sort=semver)
![GitHub](https://img.shields.io/github/license/hmasdev/autogen-werewolf)
![GitHub last commit](https://img.shields.io/github/last-commit/hmasdev/autogen-werewolf)
[![PyPI version](https://badge.fury.io/py/autogen-werewolf.svg)](https://pypi.org/project/autogen-werewolf/)
![Scheduled Test](https://github.com/hmasdev/autogen-werewolf/actions/workflows/tests-on-schedule.yaml/badge.svg)

![HEADER](pics/header.png)
Expand Down Expand Up @@ -35,7 +34,7 @@ Note that either of `docker compose` or `python` is required.
```bash
python -m venv venv
source venv/bin/activate # or `venv/Scripts/activate` in windows
python -m pip install -r requirements.txt
python -m pip install .
```

### Enjoy a Werewolf Game
Expand All @@ -57,7 +56,7 @@ You can see all options with `--help` option as follows:

```bash
$ docker compose run werewolf python -m werewolf --help
Usage: werewolf.py [OPTIONS]
Usage: python -m werewolf [OPTIONS]

Options:
-n, --n-players INTEGER The number of players. Default is 6.
Expand All @@ -66,12 +65,20 @@ Options:
-f, --n-fortune-teller INTEGER The number of fortune tellers. Default is 1.
-t, --n-turns-per-day INTEGER The number of turns per day. Default is 2.
-s, --speaker-selection-method ESPEAKERSELECTIONMETHOD
The method to select a speaker. Default is round_robin.
The method to select a speaker. Default is
round_robin.
-h, --include-human Whether to include human or not.
-o, --open-game Whether to open game or not.
-l, --log TEXT The log file name. Default is werewolf%Y%m%d%H%M%S.log
-m, --model TEXT The model name. Default is gpt-3.5-turbo-16k.
--sub-model TEXT The sub-model name. Default is gpt-3.5-turbo-instruct.
-l, --log TEXT The log file name. Default is
werewolf%Y%m%d%H%M%S.log
-m, --model TEXT The model name. Default is gpt-4o-mini.
-p, --printer TEXT The printer name. The valid values is in
('print', 'click.echo', 'logging.info').
Default is click.echo.
--sub-model TEXT The sub-model name. Default is gpt-4o-mini.
--log-level TEXT The log level, DEBUG, INFO, WARNING, ERROR
or CRITICAL. Default is WARNING.
--debug Whether to show debug logs or not.
--help Show this message and exit.
```
Expand Down
Loading

0 comments on commit d8da96a

Please sign in to comment.