Skip to content

Commit

Permalink
polishing messages
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Devyatkin <[email protected]>
  • Loading branch information
Andrey9kin committed Sep 10, 2021
1 parent 3ceff2e commit e55a3d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions helpers_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ def resolve_git_ref_to_sha1(ref_name):
return sha1


def get_commit_message_for_ref(ref_name):
def get_commit_message_for_ref(ref_name, subject_only=True):
print(f'Getting commit message for {ref_name}...')
msg = subprocess.getoutput(f'git log -n1 --pretty=tformat:%s%b {ref_name}')
format='%s' if subject_only else '%s\n%b'
msg = subprocess.getoutput(f'git log -n1 --pretty=tformat:{format} {ref_name}')
print(f'Message = {msg}')
return msg

Expand Down
5 changes: 3 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@
author_id = author_slack_id if author_slack_id is not None else author_email
commit_msg = helpers_git.get_commit_message_for_ref(current_commit_id)

text_for_request = f'Job `{build_job_name}` requires approval to proceed.\n'
text_for_request = f'Job `{build_job_name}` requires approval to proceed.\n\n'
text_for_request += 'If approved will promote commit(s) below to branch '
text_for_request += ' and '.join(f'`{branch}`' for branch in branches_to_promote)
text_for_request += f' in repository `{repo_name}`'
text_for_request += f'\nThis message will self-destruct 🕶️🧨💥 and job will be auto-cancel in {timeout_minutes} minutes if no action is taken.\n\n'
text_for_request += 'Details:\n'
text_for_request += f'Job URL: {build_job_url}\n'
text_for_request += f'Commit message: `{commit_msg}`; commit id `{current_commit_id}`\n\n'
text_for_request += f'Commit message: `{commit_msg}`\n'
text_for_request += f'Commit id: `{current_commit_id}`\n'
text_for_request += f'Committer: <@{commiter_id}>\n'
text_for_request += f'Author: <@{author_id}>\n\n'

Expand Down

0 comments on commit e55a3d8

Please sign in to comment.