aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2023-03-10 17:01:33 +1100
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2023-03-10 15:10:31 -0500
commit63fb2ff10b04b383cdc0db3f2a568209e2595222 (patch)
tree0a1655bdad3349e592dc48e0e84f550d04a8f57c
parent4f90eab09937e78f27e63a01076af72f8d45e3f3 (diff)
downloadb4-63fb2ff10b04b383cdc0db3f2a568209e2595222.tar.gz
ty: Allow a custom name/from when sending thanks
Add config options "thanks-from-name" and "thanks-from-email" that allow setting a custom name and/or from address when sending thanks. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://msgid.link/20230310060133.1610255-1-mpe@ellerman.id.au Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/ty.py8
-rw-r--r--docs/config.rst14
2 files changed, 19 insertions, 3 deletions
diff --git a/b4/ty.py b/b4/ty.py
index 863441e..6839c18 100644
--- a/b4/ty.py
+++ b/b4/ty.py
@@ -404,13 +404,16 @@ def send_messages(listing, branch, cmdargs):
os.mkdir(cmdargs.outdir)
usercfg = b4.get_user_config()
+ config = b4.get_main_config()
+ user_name = config.get('thanks-from-name', usercfg['name'])
+ user_email = config.get('thanks-from-email', usercfg['email'])
signature = b4.get_email_signature()
outgoing = 0
msgids = list()
for jsondata in listing:
- jsondata['myname'] = usercfg['name']
- jsondata['myemail'] = usercfg['email']
+ jsondata['myname'] = user_name
+ jsondata['myemail'] = user_email
jsondata['signature'] = signature
if 'pr_commit_id' in jsondata:
# This is a pull request
@@ -453,7 +456,6 @@ def send_messages(listing, branch, cmdargs):
logger.info('No thanks necessary.')
return
- config = b4.get_main_config()
pwstate = cmdargs.pw_set_state
if not pwstate:
pwstate = config.get('pw-accept-state')
diff --git a/docs/config.rst b/docs/config.rst
index 389badf..cda8fd6 100644
--- a/docs/config.rst
+++ b/docs/config.rst
@@ -257,6 +257,20 @@ These settings control the behaviour of ``b4 ty`` command.
Default: ``None``
+``b4.thanks-from-name`` (v0.13+)
+ An custom from name for sending thanks, eg::
+
+ thanks-from-name = Project Foo Thanks Bot
+
+ Default: ``None`` - falls back to user name.
+
+``b4.thanks-from-email`` (v0.13+)
+ An custom from email for sending thanks, eg::
+
+ thanks-from-email = thanks-bot@foo.org
+
+ Default: ``None`` - falls back to user email.
+
``b4.email-exclude`` (v0.9+)
A comma-separated list of shell-style globbing patterns with addresses
that should always be excluded from the recipient list.