This repository was archived by the owner on May 18, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 117
43 lines (37 loc) · 1.32 KB
/
Copy pathnews.yml
File metadata and controls
43 lines (37 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: Fetch News from Telegram and dump to a json
on:
workflow_dispatch:
schedule:
- cron: '*/1 * * * *'
jobs:
fetch-news:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Fetch updates and append to news.json
run: |
curl -s "https://api.telegram.org/bot${{ secrets.TELEGRAM_BOT_TOKEN }}/getUpdates?offset=-20" \
| jq '[.result[]
| select(.channel_post != null)
| {
message_id: .channel_post.message_id,
text: .channel_post.text,
date: .channel_post.date
}
| select(.text != null)
]' \
| jq -s '
(.[1] // []) as $old
| (.[0] // []) as $new
| ($old + $new)
| unique_by(.message_id)
' - news.json > news.tmp.json
mv news.tmp.json news.json
- name: Commit and push if changed
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add news.json
git diff --cached --quiet || git commit -m "GrindrPlus: Fetch latest news from Telegram"
git push