@plainconceptsplatform/workflows 0.4.19 → 0.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -48,6 +48,7 @@ runs:
|
|
|
48
48
|
EVENT_PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
49
49
|
COMMENT_ON_PR: ${{ github.event.issue.pull_request != '' }}
|
|
50
50
|
COMMENT_SENDER_TYPE: ${{ github.event.comment.user.type }}
|
|
51
|
+
ACTOR: ${{ github.actor }}
|
|
51
52
|
RUN_PR_NUMBER: ${{ github.event.workflow_run.pull_requests[0].number }}
|
|
52
53
|
RUN_CONCLUSION: ${{ github.event.workflow_run.conclusion }}
|
|
53
54
|
RUN_ID: ${{ github.event.workflow_run.id }}
|
|
@@ -53,9 +53,19 @@ classify_route() {
|
|
|
53
53
|
fi
|
|
54
54
|
;;
|
|
55
55
|
refine | implement | direct)
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
|
|
56
|
+
# If the actor is a bot (e.g. refine→implement transition), route directly.
|
|
57
|
+
# If the actor is a human, authorize-bot-work.yml will add bot-working which triggers the workflow.
|
|
58
|
+
if [ "${ACTOR:-}" != "" ] && echo "${ACTOR:-}" | grep -q '\[bot\]$'; then
|
|
59
|
+
route="${LABEL:-}"
|
|
60
|
+
issue_number="${EVENT_ISSUE_NUMBER:-}"
|
|
61
|
+
if [ "${LABEL:-}" = "refine" ]; then
|
|
62
|
+
refine_mode="first"
|
|
63
|
+
elif [ "${LABEL:-}" = "direct" ]; then
|
|
64
|
+
direct_mode="first"
|
|
65
|
+
fi
|
|
66
|
+
else
|
|
67
|
+
error="waiting for bot to add bot-working label"
|
|
68
|
+
fi
|
|
59
69
|
;;
|
|
60
70
|
esac
|
|
61
71
|
fi
|
|
@@ -67,6 +77,8 @@ classify_route() {
|
|
|
67
77
|
pr_number="${EVENT_ISSUE_NUMBER:-}"
|
|
68
78
|
elif [ "${COMMENT_SENDER_TYPE:-}" = "Bot" ]; then
|
|
69
79
|
error="comment authored by a bot"
|
|
80
|
+
elif has_label implement; then
|
|
81
|
+
error="issue has implement label; comments do not re-trigger implement"
|
|
70
82
|
elif has_label direct; then
|
|
71
83
|
route="direct"
|
|
72
84
|
direct_mode="continue"
|
|
@@ -387,7 +387,7 @@ jobs:
|
|
|
387
387
|
jq -r --arg repo "$REPO" '
|
|
388
388
|
.[]
|
|
389
389
|
| select(
|
|
390
|
-
.user.login == "github-actions[bot]"
|
|
390
|
+
(.user.login == "github-actions[bot]" or .user.login == "app/github-actions" or .user.login == "platform-devbox[bot]")
|
|
391
391
|
and .head.repo.full_name == $repo
|
|
392
392
|
and .mergeable_state != "dirty"
|
|
393
393
|
)
|
|
@@ -406,12 +406,25 @@ jobs:
|
|
|
406
406
|
gh api "repos/$REPO/actions/runs/$run_id/approve" --method POST
|
|
407
407
|
done
|
|
408
408
|
|
|
409
|
+
# Check if merge-gate already ran for this PR (comment on PR or linked issue)
|
|
409
410
|
gate_recorded=$(gh api "repos/$REPO/issues/$pr_number/comments?per_page=100" \
|
|
410
411
|
--jq 'any(.[]; .body | contains("<!-- agent-merge-gate -->"))')
|
|
411
412
|
if [ "$gate_recorded" = "true" ]; then
|
|
413
|
+
echo "Merge gate already recorded for PR #$pr_number, skipping"
|
|
412
414
|
continue
|
|
413
415
|
fi
|
|
414
416
|
|
|
417
|
+
# Also check the linked issue comments if the PR closes an issue
|
|
418
|
+
linked_issue=$(gh pr view "$pr_number" --repo "$REPO" --json closingIssuesReferences --jq '.closingIssuesReferences[0].number // empty' 2>/dev/null || true)
|
|
419
|
+
if [ -n "$linked_issue" ]; then
|
|
420
|
+
gate_recorded=$(gh api "repos/$REPO/issues/$linked_issue/comments?per_page=100" \
|
|
421
|
+
--jq 'any(.[]; .body | contains("<!-- agent-merge-gate -->"))')
|
|
422
|
+
if [ "$gate_recorded" = "true" ]; then
|
|
423
|
+
echo "Merge gate already recorded on issue #$linked_issue for PR #$pr_number, skipping"
|
|
424
|
+
continue
|
|
425
|
+
fi
|
|
426
|
+
fi
|
|
427
|
+
|
|
415
428
|
ci=$(gh api "repos/$REPO/actions/runs?branch=$branch&per_page=100" \
|
|
416
429
|
--jq '[.workflow_runs[]
|
|
417
430
|
| select(
|