Skip to content

feat(cosmic-daily): schedule daily run, keep PR review manual - #39

Merged
dapiced merged 5 commits into
mainfrom
dapiced-cosmic-daily-prompt
Sep 7, 2026
Merged

feat(cosmic-daily): schedule daily run, keep PR review manual#39
dapiced merged 5 commits into
mainfrom
dapiced-cosmic-daily-prompt

Conversation

@dapiced

@dapiced dapiced commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Ajoute un déclenchement automatique quotidien (\schedule: cron '0 12 * * *', soit 08:00 EDT / 07:00 EST) au workflow Cosmic Daily.

  • Les exécutions planifiées génèrent toujours l'article et ouvrent une PR (jamais d'auto-merge) — la revue humaine reste requise avant publication.
  • Le déclenchement manuel (\workflow_dispatch) garde son comportement actuel (\publish/\date\ en inputs).
  • YAML validé localement.

dapiced and others added 5 commits September 6, 2026 21:30
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
DEMO_KEY is a globally shared, rate-limited key that can respond slowly
under load. The previous 20s timeout caused the GitHub Actions workflow
to fail with a read timeout. Use a (10s connect, 45s read) timeout and
retry up to 3 times with backoff before failing.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
# Conflicts:
#	tools/cosmic-daily/cosmic_daily/nasa_client.py
Also removed the tools/cosmic-daily/cosmic_daily.egg-info directory that
was accidentally tracked from a local pip install -e . run.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adds a daily cron trigger (12:00 UTC) so Cosmic Daily runs automatically
without needing a manual workflow_dispatch. Scheduled runs always
generate + open a PR (never auto-merge), preserving human review before
publication. Manual dispatch keeps its existing publish/date inputs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings September 7, 2026 01:44
@dapiced
dapiced merged commit 7979830 into main Sep 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Scheduled runs may fail because the workflow references the inputs.* context in schedule executions, which should be made safe before enabling the daily trigger.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adds a daily scheduled trigger to the “Cosmic Daily” GitHub Actions workflow so it can automatically generate the APOD post and open a pull request for human review, while preserving manual workflow_dispatch behavior. It also improves resilience of the NASA APOD fetch logic with a more generous timeout and retry behavior.

Changes:

  • Add a schedule trigger (daily at 12:00 UTC) and route scheduled runs to “publish” mode (generate + open PR, no auto-merge).
  • Add request timeout tuning and retry/backoff logic to the NASA APOD client.
  • Ignore Python *.egg-info/ artifacts in git.
File summaries
File Description
tools/cosmic-daily/cosmic_daily/nasa_client.py Adds timeout constants and retry/backoff around APOD fetches.
.gitignore Ignores Python package metadata directories (*.egg-info/).
.github/workflows/cosmic-daily.yml Adds daily schedule trigger and publishes on scheduled runs while keeping manual dispatch behavior.
Review details

Suppressed comments (1)

.github/workflows/cosmic-daily.yml:64

  • This step also references the inputs context (${{ inputs.publish }}), which may be undefined for scheduled runs even though the bash if would choose the other branch. Use github.event.inputs.publish with a fallback to avoid potential evaluation errors on schedule.
          if [ "${{ github.event_name }}" = "schedule" ]; then
            echo "publish=true" >> "$GITHUB_OUTPUT"
          else
            echo "publish=${{ inputs.publish }}" >> "$GITHUB_OUTPUT"
          fi
  • Files reviewed: 2/3 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 48 to 52
target="${{ inputs.date }}"
if [ -z "$target" ]; then
target="$(date -u +%F)"
fi
echo "value=$target" >> "$GITHUB_OUTPUT"
Comment on lines +60 to 81
response = None
last_error: requests.RequestException | None = None
for attempt in range(1, MAX_ATTEMPTS + 1):
try:
response = requests.get(
APOD_ENDPOINT,
params={"api_key": configured_key, "date": target_day},
timeout=REQUEST_TIMEOUT,
allow_redirects=False,
)
break
except requests.RequestException as exc:
last_error = exc
if attempt < MAX_ATTEMPTS:
time.sleep(RETRY_BACKOFF_SECONDS * attempt)
if response is None:
raise RuntimeError(
f"Failed to fetch APOD for {target_day} after {MAX_ATTEMPTS} attempts: {last_error}"
) from last_error

if response.status_code != 200:
raise RuntimeError(f"NASA API returned HTTP {response.status_code} for {target_day}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants