|
13 | 13 | # │ │ │ │ │ |
14 | 14 | - cron: "0 12 * * 1-5" |
15 | 15 | workflow_dispatch: # Also allows manual runs from the GitHub Actions tab |
| 16 | + inputs: |
| 17 | + debug_fetch: |
| 18 | + description: "Diagnostic only: fetch arxiv.org/list/astro-ph/new and print status/length instead of running the digest" |
| 19 | + type: boolean |
| 20 | + default: false |
16 | 21 |
|
17 | 22 | permissions: |
18 | 23 | contents: write # to commit posted-ids.json back after each run |
|
34 | 39 | - name: Install dependencies |
35 | 40 | run: npm ci |
36 | 41 |
|
| 42 | + - name: Debug arXiv fetch |
| 43 | + if: ${{ inputs.debug_fetch }} |
| 44 | + run: | |
| 45 | + node -e ' |
| 46 | + fetch("https://arxiv.org/list/astro-ph/new").then(async res => { |
| 47 | + console.log("status:", res.status); |
| 48 | + for (const [k, v] of res.headers.entries()) console.log(k + ":", v); |
| 49 | + const html = await res.text(); |
| 50 | + console.log("html length:", html.length); |
| 51 | + const now = new Date(); |
| 52 | + const MONTHS = ["January","February","March","April","May","June","July","August","September","October","November","December"]; |
| 53 | + const todayStr = `${now.getUTCDate()} ${MONTHS[now.getUTCMonth()]} ${now.getUTCFullYear()}`; |
| 54 | + console.log("todayStr:", todayStr, "included:", html.includes(todayStr)); |
| 55 | + const newSection = html.split(/Replacement submissions/i)[0]; |
| 56 | + console.log("newSection length:", newSection.length); |
| 57 | + const ids = [...new Set([...newSection.matchAll(/arXiv:(\d{4}\.\d{4,5})/g)].map(m => m[1]))]; |
| 58 | + console.log("ids found:", ids.length); |
| 59 | + const h3 = [...html.matchAll(/<h3>([^<]*)<\/h3>/g)].map(m => m[1]); |
| 60 | + console.log("h3 headings:", JSON.stringify(h3)); |
| 61 | + console.log("--- first 500 chars ---"); |
| 62 | + console.log(html.slice(0, 500)); |
| 63 | + }).catch(err => { console.error("fetch failed:", err); process.exit(1); }); |
| 64 | + ' |
| 65 | +
|
37 | 66 | - name: Run Disk Digest |
| 67 | + if: ${{ !inputs.debug_fetch }} |
38 | 68 | env: |
39 | 69 | SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
40 | 70 | SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }} |
|
44 | 74 |
|
45 | 75 | # Persist the record of already-digested papers so later runs skip them |
46 | 76 | - name: Commit posted-ids.json |
| 77 | + if: ${{ !inputs.debug_fetch }} |
47 | 78 | run: | |
48 | 79 | test -f posted-ids.json || exit 0 |
49 | 80 | git config user.name "github-actions[bot]" |
|
0 commit comments