Skip to content

Commit

Permalink
add daily update checker
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav (Stas) Katkov committed May 28, 2024
1 parent ba9735c commit 0a6fdb4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Daily

on:
schedule:
- cron: '55 7 * * *'
workflow_dispatch:

jobs:
run_app:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '>=1.20.2'

- name: Check News updates and send them over email.
env:
MINIFLUX_URL: "https://reader.miniflux.app/v1/"
MINIFLUX_TOKEN: ${{ secrets.MINIFLUX_TOKEN }}
SMTP_USERNAME: ${{ secrets.SMTP_USERNAME }}
SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }}
SEND_TO: ${{ secrets.TO_EMAIL }}
CGO_ENABLED: 0
CATEGORY: daily
LIMIT: 5
run: |
go run main.go
4 changes: 2 additions & 2 deletions .github/workflows/runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }}
SEND_TO: ${{ secrets.TO_EMAIL }}
CGO_ENABLED: 0
CATEGORY: daily
LIMIT: 5
# CATEGORY: All
LIMIT: 10
run: |
go run main.go
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ func main() {
client := miniflux.NewClient(minifluxConfig)

if minifluxConfig.CategoryName != "" {
log.Printf("setting category to: %v", minifluxConfig.CategoryName)
log.Printf("categoryName set to: %v", minifluxConfig.CategoryName)
err = client.SetCategoryID(minifluxConfig.CategoryName)

if err != nil {
log.Fatalf("failed to set category: %v", err)
log.Fatalf("failed to set categoryId: %v", err)
return
}
} else {
log.Printf("category is not set, fetching all entries")
log.Printf("categoryName is not set, fetching all entries")
}
entries, err := client.GetUnreadEntries(minifluxConfig.Limit)

Expand All @@ -56,6 +56,6 @@ func main() {

err = client.MarkAsRead(entries)
if err != nil {
log.Fatalf("failed to mark individual RSS updates as read, due to an error: %v", err)
log.Fatalf("failed to mark RSS updates as read, due to an error: %v", err)
}
}

0 comments on commit 0a6fdb4

Please sign in to comment.