Skip to content

Commit 5b6c25e

Browse files
committed
Add github actions to update the rss feed
1 parent 4654a40 commit 5b6c25e

4 files changed

Lines changed: 40 additions & 165 deletions

File tree

.gitattributes

102 Bytes
Binary file not shown.

.github/workflows/update.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Update RSS
2+
3+
on:
4+
schedule:
5+
- cron: '0 0 * * *' # every 24 hours
6+
workflow_dispatch: # allow manual run
7+
8+
jobs:
9+
update:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repo
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
21+
- name: Install dependencies
22+
run: npm install
23+
24+
- name: Run scraper
25+
run: node index.js
26+
27+
- name: Move RSS to docs
28+
run: |
29+
mkdir -p docs
30+
mv index.xml docs/index.xml
31+
32+
- name: Commit RSS update
33+
run: |
34+
git config user.name "github-actions"
35+
git config user.email "github-actions@github.com"
36+
git add docs/index.xml
37+
git diff --cached --quiet || git commit -m "Update RSS feed"
38+
git push

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const URL = 'https://apkpure.com/android-device-policy/com.google.android.apps.w
4646

4747
let existingItems = [];
4848

49-
if (fs.existsSync('rss.xml')) {
49+
if (fs.existsSync('index.xml')) {
5050
const xmlData = fs.readFileSync('rss.xml', 'utf-8');
5151
const parser = new XMLParser();
5252
const parsed = parser.parse(xmlData);
@@ -84,5 +84,5 @@ const URL = 'https://apkpure.com/android-device-policy/com.google.android.apps.w
8484
};
8585

8686
const xml = create({version: '1.0', encoding: 'UTF-8'}, rss).end({prettyPrint: true});
87-
fs.writeFileSync('rss.xml', xml);
87+
fs.writeFileSync('index.xml', xml);
8888
})();

rss.xml

Lines changed: 0 additions & 163 deletions
This file was deleted.

0 commit comments

Comments
 (0)