Skip to content

Commit

Permalink
PTFE-1380 toggable list of options/commands to init message (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmet authored Feb 27, 2024
1 parent 653081a commit 266fb78
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Change Log
All notable changes to this project will be documented in this file.

## [3.12.0] - 2024-02-26
# Added
- Add toggable list of options and commands to init message.

## [3.11.0] - 2024-01-26
# Added
- Support of merging a PR and skip the queue when it is not needed.
Expand Down
26 changes: 26 additions & 0 deletions bert_e/templates/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,31 @@ I have created below the minimum set of tasks expected to be performed during
this review.
{% endif%}


{% if options %}
<details>
<summary><b>Available options</b></summary>

name | description | privileged | authored
------ | ------------ | ------------ |----------
{% for option in options -%}
`/{{option}}` | {{options[option].help}} | {% if options[option].privileged %} :star: {% endif %} | {% if options[option].authored %} :writing_hand: {% endif %}
{% endfor %}

</details>
{% endif %}

{% if commands %}
<details>
<summary><b>Available commands</b></summary>

name | description | privileged
------ | ------------ | ------------
{% for cmd in commands -%}
`/{{cmd}}` | {{commands[cmd].help}} | {% if commands[cmd].privileged %} :star: {% endif %}
{% endfor %}
</details>
{% endif %}

{% include 'status_report.md' %}
{% endblock %}
11 changes: 11 additions & 0 deletions bert_e/tests/test_bert_e.py
Original file line number Diff line number Diff line change
Expand Up @@ -4925,6 +4925,17 @@ def test_dependabot_pr(self):
backtrace=True
)

def test_init_message(self):
pr = self.create_pr('bugfix/TEST-00001', 'development/4.3')
self.handle(pr.id)
init_message = pr.comments[0].text
assert f"Hello {pr.author}" in init_message
# Assert init message the list of options
for option in self.bypass_all:
assert option in init_message
for command in ['help', 'reset']:
assert command in init_message


class TestQueueing(RepositoryTests):
"""Tests which validate all things related to the merge queue.
Expand Down
3 changes: 2 additions & 1 deletion bert_e/workflow/gitwaterflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ def send_greetings(job):
job.settings, job.pull_request, messages.InitMessage(
bert_e=username, author=job.pull_request.author_display_name,
status={}, active_options=job.active_options, tasks=tasks,
frontend_url=job.bert_e.settings.frontend_url
frontend_url=job.bert_e.settings.frontend_url,
options=Reactor.get_options(), commands=Reactor.get_commands()
)
)

Expand Down

0 comments on commit 266fb78

Please sign in to comment.