Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

chore(ci): label FTC-closed PRs as needs-issue (#7249)

Vidit Ostwala68b5e903c28
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index 4b0059b97..b77f5a636 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -104,7 +104,7 @@ chore(deps): bump pydantic to 2.11
- PRs over 500 lines are labeled `size/XL` automatically
- Title must follow the same conventional commit format
- Link related issues where applicable (`#123`, `Fixes #123`, or the issue URL)
-- First-time contributors must open or pick an existing **open** issue first, then mention it in the PR title or body (for example `#123`). PRs without a linked open issue are closed automatically.
+- First-time contributors must open or pick an existing **open** issue first, then mention it in the PR title or body (for example `#123`). PRs without a linked open issue are closed automatically and labeled `needs-issue`.
## Testing
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 9aada7195..267a7dfbe 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -4,7 +4,8 @@ Fixes #
<!--
First-time contributors must mention an existing open issue in this repo
-(for example #123). PRs without a linked open issue are closed automatically.
+(for example #123). PRs without a linked open issue are closed automatically
+and labeled needs-issue.
-->
## Summary
diff --git a/.github/workflows/ftc-require-issue.yml b/.github/workflows/ftc-require-issue.yml
index 2a2a842d3..a9d18d1d2 100644
--- a/.github/workflows/ftc-require-issue.yml
+++ b/.github/workflows/ftc-require-issue.yml
@@ -6,7 +6,7 @@ on:
permissions:
pull-requests: write
- issues: read
+ issues: write
concurrency:
group: ftc-require-issue-${{ github.event.pull_request.number }}
@@ -114,6 +114,19 @@ jobs:
],
check=True,
)
+ subprocess.run(
+ [
+ "gh",
+ "pr",
+ "edit",
+ pr_number,
+ "--repo",
+ repo,
+ "--add-label",
+ "needs-issue",
+ ],
+ check=True,
+ )
subprocess.run(
["gh", "pr", "close", pr_number, "--repo", repo],
check=True,
diff --git a/lib/crewai/tests/ci/test_ftc_require_issue.py b/lib/crewai/tests/ci/test_ftc_require_issue.py
index 2f166b1f3..f1128a0a8 100644
--- a/lib/crewai/tests/ci/test_ftc_require_issue.py
+++ b/lib/crewai/tests/ci/test_ftc_require_issue.py
@@ -86,6 +86,9 @@ def test_open_issue_mention_blocks_close(body: str) -> None:
)
assert not any(call[:3] == ["gh", "pr", "close"] for call in calls)
+ assert not any(
+ call[:3] == ["gh", "pr", "edit"] and "--add-label" in call for call in calls
+ )
assert any(call[:2] == ["gh", "api"] and call[2].endswith("/issues/123") for call in calls)
@@ -98,4 +101,9 @@ def test_foreign_repo_reference_closes_pr() -> None:
)
assert any(call[:3] == ["gh", "pr", "close"] for call in calls)
+ assert any(
+ call[:3] == ["gh", "pr", "edit"] and call[call.index("--add-label") + 1] == "needs-issue"
+ for call in calls
+ if "--add-label" in call
+ )
assert not any(call[:2] == ["gh", "api"] for call in calls)