Skip to content

Commit 73a614e

Browse files
Merge pull request #76 from dontcallmedom/monthly-digest
Add support for monthly digests
2 parents 01eacf1 + 1fcd8fd commit 73a614e

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ In other words:
5454
* `eventFilter` is an optional set of filters that are applied to the events above; at the moment, `label` and `notlabel` filters are defined, which means that only events that are associated with one of the said labels (defined as an array) will be notified (resp. only events that aren't associated with any of the labels)
5555
* `branches` allows to describe events that are applicable at the branch level rather than the whole repo (e.g. "push")
5656
* TR draft objects only take an `events` field, with `"tr.published"` currently the only supported event.
57-
* digests are identified by their key (of the form "digest:monday" (or any other day of the week), or "digest:daily" depending on the periodicity); each item in the said list describes a digest to be sent on that day to that list. A single digest is described by an object consisting of
57+
* digests are identified by their key (of the form "digest:monday" (or any other day of the week), or "digest:daily", "digest:monthly", "digest:quarteryly" depending on the periodicity); each item in the said list describes a digest to be sent on that day to that list. A single digest is described by an object consisting of
5858
* an optional "topic" (which will be included in the subject of the digest)
5959
* either:
6060
* a "repos" field with an array of repository full names (e.g. `w3c/webrtc-pc`) and/or a "repoList" field with an URL pointing a JSON area of repository fullnames (which gets combined with the list in `repos` if it is fetched successfully), and optionally an "eventFilter" field (which, as above, has `label` and `notlabel` as possible filters at the moment) that applies to all the said repos

index.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ def sendDigest(config, period="daily"):
303303
elif period.lower() == "quarterly":
304304
until = datetime.now() - timedelta(92)
305305
duration = "quarterly"
306+
elif period.lower() == "monthly":
307+
until = datetime.now() - timedelta(31)
308+
duration = "monthly"
306309
else:
307310
until = datetime.now() - timedelta(1)
308311
duration = period

test_digest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def test_weekly_digest(self, mock_smtp):
104104
],
105105
mock_smtp.return_value.__enter__.return_value.sendmail,
106106
)
107-
self.assertEqual(len(responses.calls), 19)
107+
self.assertEqual(len(responses.calls), 6)
108108

109109
@responses.activate
110110
@patch("smtplib.SMTP", autospec=True)

0 commit comments

Comments
 (0)