Skip to content

Merge pull request #29 from hmasdev/28-scheduled-tests-failed-patch #6

Merge pull request #29 from hmasdev/28-scheduled-tests-failed-patch

Merge pull request #29 from hmasdev/28-scheduled-tests-failed-patch #6

name: Automatically update README
on:
workflow_dispatch:
schedule:
- cron: "0 0 1 * *"
push:
branches:
- main
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 }}