diff options
author | Gerald Combs <gerald@wireshark.org> | 2020-09-03 17:47:38 -0700 |
---|---|---|
committer | AndersBroman <a.broman58@gmail.com> | 2020-09-04 09:22:04 +0000 |
commit | fd075df3f8cf8c99e598975c2a4dcd49e82147b3 (patch) | |
tree | 5ffbb55fe98d5a97d83684331a7bdde794fa08e4 /tools/validate-commit.py | |
parent | c2b69f4e9b33f662efec6855ff46b99b69632619 (diff) |
tools: Make the "Allow commits" error more obnoxious.
Add ANSI codes and emoji so that the error stands out in the pipeline
output. Clarify the text.
Diffstat (limited to 'tools/validate-commit.py')
-rwxr-xr-x | tools/validate-commit.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/validate-commit.py b/tools/validate-commit.py index d4df0a8ffa..9ae6dfc42b 100755 --- a/tools/validate-commit.py +++ b/tools/validate-commit.py @@ -171,6 +171,12 @@ def verify_merge_request(): gitlab_api_pfx = "https://gitlab.com/api/v4" # gitlab.com/wireshark/wireshark = 7898047 project_id = os.getenv('CI_MERGE_REQUEST_PROJECT_ID') + ansi_csi = '\x1b[' + ansi_codes = { + 'black_white': ansi_csi + '30;47m', + 'bold_red': ansi_csi + '31;1m', # gitlab-runner errors + 'reset': ansi_csi + '0m' + } m_r_iid = os.getenv('CI_MERGE_REQUEST_IID') if project_id is None or m_r_iid is None: print("This doesn't appear to be a merge request. CI_MERGE_REQUEST_PROJECT_ID={}, CI_MERGE_REQUEST_IID={}".format(project_id, m_r_iid)) @@ -186,13 +192,10 @@ def verify_merge_request(): try: if not m_r_attrs['allow_collaboration']: print('''\ -ERROR: Please make sure the setting - - Allow commits from members who can merge to the target branch - -is checked in your merge request so that maintainers can rebase your change -and make minor edits.\ -''') +{bold_red}ERROR:{reset} Please edit your merge request and make sure the setting + {black_white}✅ Allow commits from members who can merge to the target branch{reset} +is checked so that maintainers can rebase your change and make minor edits.\ +'''.format(**ansi_codes)) return False except KeyError: sys.stderr.write('This appears to be a merge request, but we were not able to fetch the "Allow commits" status\n') |