diff --git a/bin/fledge-github b/bin/fledge-github index fe81ee8..45178ef 100755 --- a/bin/fledge-github +++ b/bin/fledge-github @@ -26,6 +26,7 @@ SUBCOMMANDS: checks View CI/CD check status for a branch issues List and view GitHub issues prs List and view GitHub pull requests + poll Poll for new issues/PRs as daemon events (JSON) Run `fledge github --help` for subcommand-specific options. EOF @@ -40,7 +41,7 @@ SUB="$1" shift case "$SUB" in - checks|issues|prs) + checks|issues|prs|poll) exec "${DIR}/fledge-github-${SUB}" "$@" ;; -h|--help|help) diff --git a/bin/fledge-github-poll b/bin/fledge-github-poll new file mode 100755 index 0000000..7b9cb95 --- /dev/null +++ b/bin/fledge-github-poll @@ -0,0 +1,160 @@ +#!/usr/bin/env bash +# fledge-github-poll — poll GitHub for new issues and PRs since a timestamp. +# Outputs JSON array of Event objects matching the merlin daemon Event schema. +# Invoked via: fledge github poll [OPTIONS] +set -euo pipefail + +REPO="" +SINCE="" +LIMIT="30" +TYPES="issues,prs" +LABEL="" +STATE="open" + +while [ $# -gt 0 ]; do + case "$1" in + --repo) REPO="${2:-}"; shift 2;; + --since) SINCE="${2:-}"; shift 2;; + --limit) LIMIT="${2:-}"; shift 2;; + --types) TYPES="${2:-}"; shift 2;; + --label) LABEL="${2:-}"; shift 2;; + --state) STATE="${2:-}"; shift 2;; + -h|--help) + cat <<'EOF' +fledge github poll — poll for new issues and PRs as daemon events + +USAGE: + fledge github poll [OPTIONS] + +OPTIONS: + --repo Repository to poll (default: current repo) + --since Only return events after this ID (e.g. "issues/42") + --limit Maximum events per type (default: 30) + --types Comma-separated: issues,prs (default: both) + --label