Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Last.fm API Configuration
# Get your API key from: https://www.last.fm/api/account/create
LASTFM_API_KEY=your_lastfm_api_key_here
LASTFM_USER=your_lastfm_username

# Local Development Settings
README_PATH=local/DEVELOPMENT.md
SHOW_TITLE=true
LOCALE=en-US
DATE_FORMAT=MM/dd/yyyy
COMMIT_MESSAGE='chore: update Last.fm sections'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,6 @@ dist/vitest.config.d.ts
vitest.config.ts.*
.prettier-cache
reports/junit.xml

# Local development files
local/*
54 changes: 27 additions & 27 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,6 @@ pnpm run lint # ESLint check
pnpm test # Run tests
```

### Project Structure

```
src/
├── index.ts # Main entry point
├── input.ts # Input validation and parsing
├── section.ts # Section parsing and formatting
├── readme-file.ts # GitHub API operations
├── lastfm/ # Last.fm API integration
│ ├── index.ts
│ └── types.ts
├── sections/ # Section-specific updaters
│ ├── artist.ts
│ ├── album.ts
│ ├── track.ts
│ ├── recent.ts
│ └── info.ts
└── error/ # Custom error classes
└── index.ts

tests/
├── unit/ # Unit tests
├── integration/ # End-to-end workflow tests
└── golden/ # Golden file tests
└── fixtures/ # Test data and expected outputs
```

### Available Scripts

```bash
Expand All @@ -85,6 +58,33 @@ pnpm format # Format code with Prettier
pnpm types # TypeScript type checking
```

### Local Development Mode

This project includes a powerful local development mode that allows you to test all functionality without GitHub Actions.

#### Setup

1. Copy `.env.example` to `.env` and fill in your Last.fm API key and username:
```bash
cp .env.example .env
```
2. Modify the `local/DEVELOPMENT.md` file with the desired sections:

```markdown
## Example

<!--START_LASTFM_ARTISTS:{"period": "7day", "rows": 5}-->
<!--END_LASTFM_ARTISTS-->

<!--START_LASTFM_RECENT:{"rows": 5}-->
<!--END_LASTFM_RECENT-->
```

3. Run the local development script:
```bash
pnpm dev
```

## Testing

This project maintains a comprehensive test suite to ensure code quality and prevent regressions.
Expand Down
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,32 +94,27 @@ on:
# Run automatically every 6 hours
schedule:
- cron: '0 */6 * * *'

# Allow manual runs
workflow_dispatch:

# Run on push to main (optional)
push:
branches: [main]

jobs:
update-lastfm:
name: 🎤 Update Music Stats
runs-on: ubuntu-latest

steps:
- name: 🎵 Update Last.fm README
uses: dxnter/lastfm-readme@v1.5.0 # Use latest version
uses: dxnter/lastfm-readme@v1.6.0
with:
LASTFM_API_KEY: ${{ secrets.LASTFM_API_KEY }}
LASTFM_USER: your-lastfm-username # Replace with your username!
LASTFM_USER: your-lastfm-username

# Optional: Customize the commit message
COMMIT_MESSAGE: '🎵 Updated music stats'
COMMIT_MESSAGE: '🎵 Update music stats'

# Optional: For cross-repository updates
# GH_TOKEN: ${{ secrets.GH_TOKEN }}
# REPOSITORY: username/username
# REPOSITORY: username/repository
```

<details>
Expand Down
Loading