Skip to content

Commit

Permalink
feat: include_bots: true will include bot activity. #25
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Nov 10, 2022
1 parent 4cd7e5c commit e732d95
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
11 changes: 7 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,14 @@ clause sets defaults for the digest options in the rest of the file. Each

Items can have additional options:

- No activity is reported for bot users. Some applications act as real users,
but should be ignored anyway. You can list those user names that should be
ignored in the ``ignore_users`` setting.
- By default, no activity is reported for bot users. If you want to include
them, use ``include_bots: true``.

- Items can have an explicit title set with the ``title:`` setting.
- Some applications perform actions using real user accounts, but you'd like to
ignore them anyway. You can list those user names that should be ignored in
the ``ignore_users`` setting.

- Digests can have an explicit title set with the ``title`` setting.

- Options for organization projects include:

Expand Down
8 changes: 8 additions & 0 deletions scriv.d/20221027_061417_nedbat.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Added
.....

- A new setting ``include_bots: true`` will include pull requests, issues, or
comments created by bot users. The default remains False, to exclude them.
Closes `issue 25`_.

.. _issue 25: https://github.com/nedbat/dinghy/issues/25
5 changes: 4 additions & 1 deletion src/dinghy/digest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ class Digester:
def __init__(self, since, options):
self.since = since.strftime("%Y-%m-%dT%H:%M:%S")
self.ignore_users = options.get("ignore_users", [])
self.user_types = {"User"}
if options.get("include_bots", False):
self.user_types.add("Bot")
self.api_root = options.get("api_root")
self.github = "github.com"
self.gql = None
Expand Down Expand Up @@ -250,7 +253,7 @@ def _node_is_interesting(self, node):
"""
return (
node["updatedAt"] > self.since
and node["author"]["__typename"] == "User"
and node["author"]["__typename"] in self.user_types
and node["author"]["login"] not in self.ignore_users
)

Expand Down

0 comments on commit e732d95

Please sign in to comment.