From: Michael Ellerman <mpe@ellerman.id.au>
To: tools@linux.kernel.org
Subject: [PATCH] ty: Allow a custom name/from when sending thanks
Date: Fri, 10 Mar 2023 17:01:33 +1100 [thread overview]
Message-ID: <20230310060133.1610255-1-mpe@ellerman.id.au> (raw)
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>
---
b4/ty.py | 8 +++++---
docs/config.rst | 14 ++++++++++++++
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/b4/ty.py b/b4/ty.py
index 15b02ed..165afd9 100644
--- a/b4/ty.py
+++ b/b4/ty.py
@@ -440,13 +440,16 @@ BRANCH_INFO = None
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
@@ -489,7 +492,6 @@ BRANCH_INFO = None
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..c43f32d 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``
+ 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.
--
2.39.2
next reply other threads:[~2023-03-10 6:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-10 6:01 Michael Ellerman [this message]
2023-03-10 20:11 ` [PATCH] ty: Allow a custom name/from when sending thanks Konstantin Ryabitsev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230310060133.1610255-1-mpe@ellerman.id.au \
--to=mpe@ellerman.id.au \
--cc=tools@linux.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).