Test and Update README #524
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }} |