Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add short emoji status to toolstate updates #56758

Merged
merged 1 commit into from
Dec 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may just be missing it but I can't find msg referenced anywhere else. Should these be emoji?

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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a Python syntax error

message = short_message + "\n\n" + long_message
f.seek(0)
f.truncate(0)
json.dump(latest, f, indent=4, separators=(',', ': '))
Expand Down