Rollup merge of #56758 - Manishearth:emoji-status-toolstate, r=kennytm

Add short emoji status to toolstate updates

I get a lot of these emails and it's good to know which ones I should be paying closer attention to -- i.e. the ones where clippy breaks. This adds a short emoji status report to the first line of the commit message, which shows up in notifications directly

I haven't been able to test it, and the actual emoji are just suggestions.

r? @kennytm

cc @rust-lang/infra @rust-lang/devtools
This commit is contained in:
Pietro Albini 2018-12-15 10:17:37 +01:00 committed by GitHub
commit 050bb10dc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,6 +34,16 @@ MAINTAINERS = {
'rust-by-example': '@steveklabnik @marioidival @projektir', 'rust-by-example': '@steveklabnik @marioidival @projektir',
} }
EMOJI = {
'miri': '🛰️',
'clippy-driver': '📎',
'rls': '💻',
'rustfmt': '📝',
'book': '📖',
'nomicon': '👿',
'reference': '📚',
'rust-by-example': '👩‍🏫',
}
def read_current_status(current_commit, path): def read_current_status(current_commit, path):
'''Reads build status of `current_commit` from content of `history/*.tsv` '''Reads build status of `current_commit` from content of `history/*.tsv`
@ -63,13 +73,12 @@ def update_latest(
} }
slug = 'rust-lang/rust' slug = 'rust-lang/rust'
message = textwrap.dedent('''\ long_message = textwrap.dedent('''\
📣 Toolstate changed by {}!
Tested on commit {}@{}. Tested on commit {}@{}.
Direct link to PR: <{}> Direct link to PR: <{}>
''').format(relevant_pr_number, slug, current_commit, relevant_pr_url) ''').format(slug, current_commit, relevant_pr_url)
emoji_status = []
anything_changed = False anything_changed = False
for status in latest: for status in latest:
tool = status['tool'] tool = status['tool']
@ -81,12 +90,18 @@ def update_latest(
status[os] = new status[os] = new
if new > old: if new > old:
changed = True changed = True
message += '🎉 {} on {}: {}{} (cc {}, @rust-lang/infra).\n' \ long_message += '🎉 {} on {}: {}{}.\n' \
.format(tool, os, old, new, MAINTAINERS.get(tool)) .format(tool, os, old, new)
emoji = "{}🎉".format(EMOJI.get(tool))
if msg not in emoji_status:
emoji_status += [msg]
elif new < old: elif new < old:
changed = True changed = True
message += '💔 {} on {}: {}{} (cc {}, @rust-lang/infra).\n' \ long_message += '💔 {} on {}: {}{} (cc {}, @rust-lang/infra).\n' \
.format(tool, os, old, new, MAINTAINERS.get(tool)) .format(tool, os, old, new, MAINTAINERS.get(tool))
emoji = "{}💔".format(EMOJI.get(tool))
if msg not in emoji_status:
emoji_status += [msg]
if changed: if changed:
status['commit'] = current_commit status['commit'] = current_commit
@ -96,6 +111,9 @@ def update_latest(
if not anything_changed: if not anything_changed:
return '' return ''
short_message = "📣 Toolstate changed by {}! ({})"
.format(relevant_pr_number, '/'.join(emoji_status))
message = short_message + "\n\n" + long_message
f.seek(0) f.seek(0)
f.truncate(0) f.truncate(0)
json.dump(latest, f, indent=4, separators=(',', ': ')) json.dump(latest, f, indent=4, separators=(',', ': '))