Skip to content

Commit

Permalink
Merge pull request #7 from rtuszik/docker
Browse files Browse the repository at this point in the history
v1.0.0
  • Loading branch information
rtuszik authored Sep 19, 2024
2 parents 770d7a8 + c7de407 commit da698b2
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 33 deletions.
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
updates:
# Update Python packages
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10

# Update GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10

# Update Docker base images
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
15 changes: 8 additions & 7 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: StarWarden Build

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
push:
branches-ignore: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:

env:
DOCKER_IMAGE: rtuszik/starwarden
DOCKER_IMAGE: rtuszik/starwarden

jobs:
build-and-push:
Expand All @@ -27,6 +27,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
context: .
Expand All @@ -37,4 +38,4 @@ jobs:
cache-to: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache,mode=max

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
run: echo ${{ steps.docker_build.outputs.digest }}
20 changes: 17 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
name: Lint
on: [push, pull_request]
on:
push:
branches-ignore: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:

permissions: {}

jobs:
lint:
runs-on: ubuntu-latest

permissions:
contents: read
packages: read
statuses: write

steps:
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Lint Code Base
uses: github/super-linter@v4
uses: github/super-linter@v7
env:
VALIDATE_ALL_CODEBASE: true
FIX_PYTHON_RUFF: true
VALIDATE_PYTHON_RUFF: true
FIX_MARKDOWN_PRETTIER: true
VALIDATE_MARKDOWN_PRETTIER: true
VALIDATE_GITLEAKS: true
VALIDATE_GITHUB_ACTIONS: true
Expand Down
66 changes: 54 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,8 @@ StarWarden exports GitHub starred repositories to Linkwarden as individual links

- Export GitHub stars to Linkwarden
- Create new or update existing Linkwarden collections
- Handle API rate limiting
- Command-line interface

## Requirements

- Python 3.6+
- GitHub account
- Linkwarden account and API token
- Python packages listed in `requirements.txt`
- TUI Interface
- Docker support for unsupervised updates

## Setup

Expand Down Expand Up @@ -44,10 +37,59 @@ Run:
python starwarden.py
```

For debug logging:
To directly update an existing collection without an interactive menu, run:

```bash
python starwarden.py -id YOUR_COLLECTION_ID
```

## Unsupervised Updates

For automated, unsupervised updates, you can use Docker with the provided docker-compose.yml file.

1. Make sure you have Docker and Docker Compose installed on your system.

2. Create a `.env` file in the project root with the following variables:

```bash
GITHUB_TOKEN=your_github_token
GITHUB_USERNAME=your_github_username
LINKWARDEN_URL=your_linkwarden_instance_url
LINKWARDEN_TOKEN=your_linkwarden_api_token
COLLECTION_ID=your_linkwarden_collection_id
CRON_SCHEDULE=0 0 * * * # Run daily at midnight, adjust as needed
```

3. Use the following `docker-compose.yml` file:

```yaml
version: "3"
services:
starwarden:
image: rtuszik/starwarden:latest
env_file: .env
volumes:
- ./starwarden.log:/app/starwarden.log
```
4. Run the following command to start the Docker container:
```bash
docker compose up -d
```

The container will now automatically run StarWarden on the specified schedule without any manual intervention.

To manually trigger an update, you can run:

```bash
python starwarden.py --debug
docker compose exec starwarden python /app/starwarden.py -id $COLLECTION_ID
```

Follow the prompts to update or create a collection.
## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
14 changes: 3 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
version: '3'

services:
starwarden:
image: rtuszik/starwarden
# env_file: .env ### for use with env file
environment:
- GITHUB_TOKEN=${GITHUB_TOKEN}
- GITHUB_USERNAME=${GITHUB_USERNAME}
- LINKWARDEN_URL=${LINKWARDEN_URL}
- LINKWARDEN_TOKEN=${LINKWARDEN_TOKEN}
- COLLECTION_ID=${COLLECTION_ID}
- CRON_SCHEDULE=${CRON_SCHEDULE:-0 0 * * *}
image: rtuszik/starwarden:latest
env_file: .env
volumes:
- ./starwarden.log:/app/starwarden.log
- ./starwarden.log:/app/starwarden.log

0 comments on commit da698b2

Please sign in to comment.