Skip to content

Commit

Permalink
Rollup merge of rust-lang#56758 - Manishearth:emoji-status-toolstate,…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
kennytm committed Dec 13, 2018
2 parents 85fc7af + ae893bb commit 8caa657
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions src/tools/publish_toolstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@
'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):
'''Reads build status of `current_commit` from content of `history/*.tsv`
Expand Down Expand Up @@ -63,13 +73,12 @@ def update_latest(
}

slug = 'rust-lang/rust'
message = textwrap.dedent('''\
πŸ“£ Toolstate changed by {}!
long_message = textwrap.dedent('''\
Tested on commit {}@{}.
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
for status in latest:
tool = status['tool']
Expand All @@ -81,12 +90,18 @@ def update_latest(
status[os] = new
if new > old:
changed = True
message += 'πŸŽ‰ {} on {}: {} β†’ {} (cc {}, @rust-lang/infra).\n' \
.format(tool, os, old, new, MAINTAINERS.get(tool))
long_message += 'πŸŽ‰ {} on {}: {} β†’ {}.\n' \
.format(tool, os, old, new)
emoji = "{}πŸŽ‰".format(EMOJI.get(tool))
if msg not in emoji_status:
emoji_status += [msg]
elif new < old:
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))
emoji = "{}πŸ’”".format(EMOJI.get(tool))
if msg not in emoji_status:
emoji_status += [msg]

if changed:
status['commit'] = current_commit
Expand All @@ -96,6 +111,9 @@ def update_latest(
if not anything_changed:
return ''

short_message = "πŸ“£ Toolstate changed by {}! ({})"
.format(relevant_pr_number, '/'.join(emoji_status))
message = short_message + "\n\n" + long_message
f.seek(0)
f.truncate(0)
json.dump(latest, f, indent=4, separators=(',', ': '))
Expand Down

0 comments on commit 8caa657

Please sign in to comment.