Automation
Literature Alert
Author: Nara Avila | Published 10 Jan 2026
Your research radar

Let the papers come to you

Literature Alerts is a Python runner that retrieves papers from arXiv using YAML topic queries and publishes them to Discord through webhooks. GitHub Actions runs the fetch on a schedule or on demand, while date filters and message modes shape the stream. The result is a configurable reading radar for research areas you want to follow.

  1. arXiv query
  2. Date filter
  3. Discord destination
  4. Execution report
01

Create a stream for a research topic

Fork the repository and create or edit a YAML file under topics/. Each entry identifies a research topic with an id, a display title, an arxiv_url query and a webhook_env destination variable. These are research streams defined by queries, rather than arXiv discussion threads. The runner consumes the query URL as supplied.

YAMLDefine the research streamActual project source
topics/hep.ymlLines 1–10
topics:
  - id: hep-ex
    title: "High Energy Physics - Experiment"
    webhook_env: "DISCORD_WEBHOOK_URL_HEP_EX"
    arxiv_url: "https://export.arxiv.org/api/query?search_query=cat:hep-ex&sortBy=submittedDate&sortOrder=descending&max_results=100"

  - id: hep-ph
    title: "High Energy Physics - Phenomenology"
    webhook_env: "DISCORD_WEBHOOK_URL_HEP_PH"
    arxiv_url: "https://export.arxiv.org/api/query?search_query=cat:hep-ph&sortBy=submittedDate&sortOrder=descending&max_results=100"
Real topic entries for experimental high-energy physics and phenomenology. Each query is paired with a named webhook environment variable.
02

Connect the topic to Discord

In your Discord channel, open Settings → Integrations → New Webhook and copy its URL. In your GitHub repository, open Settings → Secrets and variables → Actions and create a repository secret for that URL. Expose the secret as the environment variable named by webhook_env in the workflow step.

YAMLBind the delivery destinationActual project source
      - name: Run HEP topics via runner
        env:
          TIME_FRAME: ${{ github.event.inputs.time_frame || '1' }}
          ONLY_TOPIC: ${{ github.event.inputs.only_topic || 'all' }}

          DISCORD_WEBHOOK_URL_BARYOGENESIS: ${{ secrets.DISCORD_HEP_EARLY_UNIVERSE_BARYOGENESIS_WEBHOOK }}
          DISCORD_WEBHOOK_URL_QGP_ML: ${{ secrets.DISCORD_HEP_QGP_ML_WEBHOOK }}
          DISCORD_WEBHOOK_URL_QGP_NN: ${{ secrets.DISCORD_HEP_QGP_NEURAL_WEBHOOK }}
          DISCORD_WEBHOOK_URL_QGP_BAYESIAN: ${{ secrets.DISCORD_HEP_QGP_BAYESIAN_INFERENCE_WEBHOOK }}
          DISCORD_WEBHOOK_URL_QGP_DKL: ${{ secrets.DISCORD_HEP_QGP_DEEP_KERNEL_LEARNING_WEBHOOK }}
          DISCORD_WEBHOOK_URL_NUCL_EX: ${{ secrets.DISCORD_HEP_NUCLEAR_EXPERIMENT_WEBHOOK }}
          DISCORD_WEBHOOK_URL_NUCL_TH: ${{ secrets.DISCORD_HEP_NUCLEAR_THEORY_WEBHOOK }}
          DISCORD_WEBHOOK_URL_HEP_LAT: ${{ secrets.DISCORD_HEP_LATTICE_WEBHOOK }}
          DISCORD_WEBHOOK_URL_HEP_TH: ${{ secrets.DISCORD_HEP_THEORY_WEBHOOK }}
          DISCORD_WEBHOOK_URL_HEP_PH: ${{ secrets.DISCORD_HEP_PHENOMENOLOGY_WEBHOOK }}
          DISCORD_WEBHOOK_URL_HEP_EX: ${{ secrets.DISCORD_HEP_EXPERIMENT_WEBHOOK }}

        run: python runner.py topics/hep.yml
The actual HEP workflow step exposes repository secrets as environment variables and passes topics/hep.yml to the runner. These are secret references, not webhook values.
03

Choose when the fetch runs

Edit .github/workflows/check-new-papers.yml. Its existing schedule is 0 8 * * *: daily at 08:00 UTC, or 05:00 in São Paulo (UTC−3). For a daily run at 09:00 São Paulo time, change the cron expression to 0 12 * * *. The excerpt below preserves the project’s current schedule. Commit the workflow to the default branch. You can also run it manually from Actions with the topic and time-frame inputs.

YAMLSet the automation clockActual project source
on:
  schedule:
    - cron: "0 8 * * *"   # daily at 08:00 UTC = 05:00 BRT (UTC-3)
  workflow_dispatch:
    inputs:
      only_topic:
        description: "Run only this topic id (default: all)"
        required: false
        default: "all"
        type: string
      time_frame:
        description: "Days back (default: 1) or 'all'"
        required: false
        default: "1"
        type: string
The project runs daily at 08:00 UTC, or 05:00 São Paulo time, and exposes topic and time-window inputs for manual runs.
04

Tune the signal and the delivery pace

Environment variableDefaultWhat it controls
TIME_FRAME1Days of papers to include; use all to disable date filtering.
ONLY_TOPICallRun only the matching topic id, or every topic.
MODEautoauto, per_paper or summary delivery.
REQUEST_TIMEOUT20HTTP timeout in seconds.
MAX_RETRIES_4298Extra attempts after Discord HTTP 429 rate limits.
POST_DELAY_SECONDS0.4Delay between individual paper posts.
MAX_POSTS_PER_TOPIC0Post cap after date filtering; 0 means no cap.
DISCORD_CHUNK_LIMIT1800Maximum summary chunk size.
SUMMARY_THRESHOLD50Force summary delivery above this paper count.
PythonRead the runner defaultsActual project source
runner.pyLines 38–50
TIME_FRAME_RAW = os.getenv("TIME_FRAME", "1").strip().lower()   # "1", "7", "30", "360", "all"
ONLY_TOPIC = os.getenv("ONLY_TOPIC", "all").strip()             # "all" or a topic id  # >>> CHANGED
MODE = os.getenv("MODE", "auto").strip().lower()               # "auto" | "per_paper" | "summary"
REQUEST_TIMEOUT = int(os.getenv("REQUEST_TIMEOUT", "20"))

POST_DELAY_SECONDS = float(os.getenv("POST_DELAY_SECONDS", "0.4"))
MAX_RETRIES_429 = int(os.getenv("MAX_RETRIES_429", "8"))
DISCORD_CHUNK_LIMIT = int(os.getenv("DISCORD_CHUNK_LIMIT", "1800"))

MAX_POSTS_PER_TOPIC = int(os.getenv("MAX_POSTS_PER_TOPIC", "0"))  # 0 = no cap after time filter

# Safety: if too many papers, force summary (prevents floods / 429)  # >>> CHANGED
SUMMARY_THRESHOLD = int(os.getenv("SUMMARY_THRESHOLD", "50"))
These defaults are read from environment variables at startup. Set an override in the workflow step’s env block to change a value.
05

Read the report before expanding the stream

When adding a topic file, add a workflow step that binds its required webhook variables and passes the file to runner.py. Run the workflow manually, then open Actions → arXiv → Discord → run details. Check fetched and filtered article counts, posted messages and errors. Confirm delivery in Discord before expanding the queries.

PythonUnderstand the execution summaryActual project source
runner.pyLines 290–296
    # --- SUMMARY ---
    print("---")
    print(f"Total results on arXiv   : {total_available}")
    print(f"Total fetched from arXiv : {total_fetched}")
    print(f"Passed time filter       : {len(papers)}")
    print(f"Successfully posted      : {posted_ok}")
    print(f"Failed to post           : {posted_fail}")
The actual summary code prints fetched articles, papers that pass the date filter, successful posts and failures. In summary mode, posted counts refer to message chunks, not individual papers.

This page was last updated at 2026-11-03 16:10.