fix: add missing import and update tests for branch template feature (#799)

* fix: add missing import and update tests for branch template feature

- Add missing `import { $ } from 'bun'` in branch.ts
- Add missing `labels` property to pull-request-target.test.ts fixture
- Update branch-template tests to expect 5-word descriptions

* address review feedback: update comment and add truncation test
This commit is contained in:
Ashwin Bhat
2026-01-08 07:07:54 +05:30
committed by GitHub
parent c247cb152d
commit 1b8ee3b941
4 changed files with 25 additions and 5 deletions

View File

@@ -6,6 +6,7 @@
* - For Issues: Create a new branch
*/
import { $ } from "bun";
import { execFileSync } from "child_process";
import * as core from "@actions/core";
import type { ParsedGitHubContext } from "../context";

View File

@@ -7,9 +7,12 @@
const NUM_DESCRIPTION_WORDS = 5;
/**
* Extracts the first `numWords` words from a title and converts them to kebab-case
* Extracts the first 5 words from a title and converts them to kebab-case
*/
function extractDescription(title: string, numWords: number = NUM_DESCRIPTION_WORDS): string {
function extractDescription(
title: string,
numWords: number = NUM_DESCRIPTION_WORDS,
): string {
if (!title || title.trim() === "") {
return "";
}