Skip to content

Commit 19dcce6

Browse files
committed
Add logs for github action
1 parent 71978c1 commit 19dcce6

2 files changed

Lines changed: 27 additions & 9 deletions

File tree

.github/workflows/update.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
env:
3434
GH_PAT: ${{ secrets.GH_PAT }}
3535
run: |
36-
git config user.name "github-actions"
37-
git config user.email "github-actions@github.com"
36+
git config user.name 'github-actions[bot]'
37+
git config user.email 'github-actions[bot]@users.noreply.github.com'
3838
git add docs/index.xml
3939
git diff --cached --quiet || git commit -m "Update RSS feed"
40-
git push https://x-access-token:${GH_PAT}@github.com/${{ github.repository }}.git HEAD:master
40+
git push https://x-access-token:${{GH_PAT}}@github.com/${{ github.repository }}.git HEAD:master

index.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ const URL = 'https://apkpure.com/android-device-policy/com.google.android.apps.w
1414
console.log('Browser launched');
1515

1616
let versions = [];
17-
17+
let page
1818

1919
try {
20-
const page = await browser.newPage();
20+
page = await browser.newPage();
2121
await page.goto(URL, { waitUntil: 'networkidle2' });
2222
console.log('✅ Page loaded');
2323

@@ -45,15 +45,33 @@ const URL = 'https://apkpure.com/android-device-policy/com.google.android.apps.w
4545
return result;
4646
});
4747

48-
console.log(`✅ Scraped ${versions.length} versions`);
49-
if (versions.length) console.log('[Sample]:', versions[0]);
48+
if (!versions || versions.length === 0) {
49+
console.warn('⚠️ No versions scraped — dumping page content for debugging');
50+
51+
const fs = await import('fs/promises');
52+
const html = await page.content();
53+
await fs.mkdir('docs', { recursive: true });
54+
await fs.writeFile('docs/debug.html', html);
55+
await page.screenshot({ path: 'docs/screenshot.png', fullPage: true });
56+
57+
console.log('📝 Saved debug.html and screenshot.png to docs/');
58+
}
59+
60+
if (versions.length) console.log(`✅ Scraped ${versions.length} versions`);
5061
} catch (e) {
5162
console.error('❌ Page load failed:', e);
63+
const errorHtml = await page.content();
64+
await page.screenshot({ path: 'docs/screenshot.png', fullPage: true });
65+
66+
const fs = await import('fs/promises');
67+
await fs.mkdir('docs', { recursive: true });
68+
await fs.writeFile('docs/debug.html', errorHtml);
69+
70+
console.log('📝 Saved debug.html and screenshot.png to docs/');
5271
}
5372

5473
await browser.close();
55-
56-
console.log(`✅ Scraped ${versions.length} versions`);
74+
5775
//console.log(versions);
5876

5977
let existingItems = [];

0 commit comments

Comments
 (0)