Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update README

Update README #1927

Workflow file for this run

name: Update README
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
jobs:
update-readme:
runs-on: ubuntu-latest
steps:
# ÉTAPE 1 : On télécharge le code du dépôt.
- name: Checkout repository
uses: actions/checkout@v3
# ÉTAPE 2 : ON SYNCHRONISE AVEC LE DERNIER COMMIT.
# C'est l'étape cruciale qui garantit que nous avons la dernière version du script.
- name: Synchronize with the latest version from GitHub
run: |
git fetch origin
git reset --hard origin/main
# ÉTAPE 3 : On prépare l'environnement Python.
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
# ÉTAPE 4 : On exécute le script (qui est maintenant la bonne version).
- name: Run Python script to update README
run: python auto/update_readme.py
# ÉTAPE 5 : On envoie les modifications du README sur GitHub (s'il y en a).
- name: Commit and push changes if any
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add README.md
# On vérifie s'il y a réellement des changements avant de commiter
if ! git diff --staged --quiet; then
echo "README.md was modified. Committing and pushing changes..."
git commit -m "Update README with new image"
git push
else
echo "No changes detected in README.md. Nothing to commit."
fi