Skip to content

Commit

Permalink
✨ handle removed from merge queue
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Sep 8, 2024
1 parent 8fb864b commit 7a25b83
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author : yanyongyu
* @Date : 2022-09-17 09:17:06
* @LastEditors : yanyongyu
* @LastEditTime : 2024-08-18 17:46:26
* @LastEditTime : 2024-09-08 12:06:11
* @Description : None
* @GitHub : https://github.com/yanyongyu
-->
Expand Down Expand Up @@ -65,7 +65,7 @@ highlight_comment: int | None
<div class="ml-0 pl-0 ml-md-6 pl-md-3">
{# merged: current pr state #}
{# reviews: previous review events #}
{% set ns = namespace(merged=false, reviews={}) %}
{% set ns = namespace(merged=false, merge_via_queue=false, reviews={}) %}
{{ commented(
issue.user, issue.user_avatar, issue.created_at,
issue.body_html, issue.body, issue.author_association,
Expand Down Expand Up @@ -202,7 +202,7 @@ highlight_comment: int | None
{% set ns.merged = true %}
{{ merged(
event.actor, event.actor_avatar, event.created_at,
event.commit_id, issue.base_ref
event.commit_id, issue.base_ref, ns.merge_via_queue
) }}
{% elif event.event == "milestoned" %}
{{ milestoned(
Expand All @@ -227,6 +227,10 @@ highlight_comment: int | None
event.actor, event.actor_avatar, event.created_at,
is_pull_request, event.commit_id
) }}
{% elif event.event == "removed_from_merge_queue"%}
{# mark pr is merged by merge queue #}
{% set ns.merge_via_queue = true %}
{# removed_from_merge_queue event ignored #}
{% elif event.event == "removed_from_project" %}
{{ removed_from_project(
event.actor, event.actor_avatar, event.created_at,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author : yanyongyu
* @Date : 2022-09-26 05:38:30
* @LastEditors : yanyongyu
* @LastEditTime : 2024-05-16 16:03:51
* @LastEditTime : 2024-09-08 12:05:49
* @Description : None
* @GitHub : https://github.com/yanyongyu
-->
Expand All @@ -15,13 +15,28 @@ actor_avatar: str
created_at: datetime
commit_id: str
base_ref: str
merged_via_queue: bool
#}
{% macro merged(actor, actor_avatar, created_at, commit_id, base_ref) %}
{% macro merged(actor, actor_avatar, created_at, commit_id, base_ref, merged_via_queue) %}
<div class="TimelineItem">
<div class="TimelineItem-badge color-fg-on-emphasis color-bg-done-emphasis">
{{ octicon_pr_merged(16, "color-fg-inherit") }}
</div>
<div class="TimelineItem-body">
{% if merged_via_queue %}
Merged via the queue into
<span class="branch-name css-truncate color-fg-muted">
<a class="no-underline">
{{ base_ref|escape }}
</a>
</span>
with commit
<a href="#">
<code class="Link--primary text-bold">
{{ commit_id[:7] }}
</code>
</a>
{% else %}
<a>
<img
class="avatar avatar-user"
Expand All @@ -43,6 +58,7 @@ base_ref: str
{{ base_ref|escape }}
</a>
</span>
{% endif %}
<a class="Link--secondary">{{ created_at|relative_time }}</a>
</div>
</div>
Expand Down

0 comments on commit 7a25b83

Please sign in to comment.