Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/deposit-ready.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ on:
push:
branches: [main]
paths: ['articles/**/metadata.yml']
# A note published before this workflow existed, or one whose metadata has
# not moved since, is never asked about by the push trigger -- it fires on a
# CHANGE, and the condition here is a STATE: archival, published, no record.
# Retrofitting the boundary-conditions note found exactly that; it had to be
# asked for by hand. So the same question is asked weekly, and the guard on
# what is already open means a request left waiting is not asked again.
schedule:
# Mondays, 21:00 UTC -- an hour before the `outstanding` report, so a
# request opened here appears in that week's issue rather than the next.
- cron: '0 21 * * 1'
workflow_dispatch:

permissions:
Expand Down
26 changes: 26 additions & 0 deletions tests/test_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2372,3 +2372,29 @@ def test_an_open_request_is_not_asked_for_twice():
"it must match the requests it opens itself"
assert "if s not in asked" in ask_step, \
"and it must subtract them from what it asks about"


def test_the_deposit_reminder_asks_on_a_schedule_as_well_as_on_a_push():
"""The push trigger fires on a metadata CHANGE; the condition it cares
about is a STATE — archival, published, and holding no record.

A note published before this workflow existed, or one whose metadata has
not moved since, is therefore never asked about. Retrofitting the
boundary-conditions note found exactly that: it had to be asked for by
hand. The schedule closes it, and the open-request guard is what makes a
repeating trigger safe.
"""
src = (ROOT / ".github" / "workflows" / "deposit-ready.yml").read_text(
encoding="utf-8")
# Read as text rather than YAML: pyyaml is not in the test environment,
# and the triggers are a flat block at the top of the file.
triggers = src.split("jobs:")[0]
assert "schedule:" in triggers, "a state condition needs a repeating trigger"
assert "cron:" in triggers
assert "workflow_dispatch:" in triggers, \
"and a manual route, for a note in a hurry"

# A repeating trigger without the guard would mint a fresh DOI every week
# for every request left waiting. The two belong together.
assert "gh pr list --state open" in src, \
"a scheduled reminder MUST skip what it has already asked about"
Loading