Skip to content

Commit 9a69e97

Browse files
committed
debugging
1 parent 17658ce commit 9a69e97

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

.github/scripts/fetch-cats.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ const https = require('https');
22
const fs = require('fs');
33

44
const API_KEY = process.env.CAT_API_KEY;
5+
console.log('API Key exists:', !!API_KEY);
6+
57
const OUTPUT_FILE = '_data/cats.json';
68

79
const options = {
@@ -12,6 +14,8 @@ const options = {
1214
}
1315
};
1416

17+
console.log('Making request to:', `https://${options.hostname}${options.path}`);
18+
1519
https.get(options, (resp) => {
1620
let data = '';
1721

@@ -20,18 +24,22 @@ https.get(options, (resp) => {
2024
});
2125

2226
resp.on('end', () => {
27+
console.log('Response received:', data.substring(0, 100) + '...');
28+
2329
// Create directory if it doesn't exist
2430
const dir = '_data';
2531
if (!fs.existsSync(dir)){
2632
fs.mkdirSync(dir);
33+
console.log('Created _data directory');
2734
}
2835

2936
// Save the cat data
3037
fs.writeFileSync(OUTPUT_FILE, data);
31-
console.log('Cat data saved successfully!');
38+
console.log('Cat data saved to:', OUTPUT_FILE);
39+
console.log('File contents:', fs.readFileSync(OUTPUT_FILE, 'utf8').substring(0, 100) + '...');
3240
});
3341

3442
}).on("error", (err) => {
35-
console.error("Error: " + err.message);
43+
console.error("Error making request:", err.message);
3644
process.exit(1);
3745
});

.github/workflows/publish.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,20 @@ jobs:
3232
run: |
3333
mkdir -p _data
3434
node .github/scripts/fetch-cats.js
35+
echo "Checking if cats.json exists:"
36+
ls -l _data/
37+
echo "Contents of cats.json:"
38+
cat _data/cats.json
3539
env:
3640
CAT_API_KEY: ${{ secrets.CAT_API_KEY }}
3741

3842
- name: Render Quarto Project
39-
run: quarto render
43+
run: |
44+
echo "Contents of _data before render:"
45+
ls -l _data/
46+
quarto render
47+
echo "Contents of _site after render:"
48+
ls -l _site/
4049
4150
- name: Deploy to GitHub Pages
4251
uses: peaceiris/actions-gh-pages@v3

0 commit comments

Comments
 (0)