Skip to content

Test and Update README #524

Test and Update README

Test and Update README #524

Workflow file for this run

name: Test and Update README
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run statsfm-to-markdown action (local)
uses: ./
id: statsfm
with:
statsfm_username: 'teraha'
display_limit: '10'
items_per_row: '5'
readme_path: 'README.md'
theme: 'light'
time_range: 'weeks'
- name: Update README timestamp
run: |
# Use GNU sed compatible syntax for macOS and Linux runners
sed -i.bak "s/{{ env.TODAY }}/$(date '+%Y-%m-%d %H:%M:%S %Z')/g" README.md && rm README.md.bak
- name: Commit and push changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "statsfm-to-markdown Action"
# Add README (SVG directory is only used in svg display_mode)
if [ -d statsfm_svgs ]; then
git add README.md statsfm_svgs/
else
git add README.md
fi
# Check if there are changes to commit
if git diff --staged --quiet; then
echo "No changes to commit."
exit 0
else
git commit -m "docs: Update stats.fm top albums"
echo "Pushing changes..."
git push
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}