Repository: anuraghazra/github-readme-stats
Pull request #3490 (2023-11-20 18:05:51)

build(deps): Bump rickstaa/empty-issues-closer-action from 1.1.44 to 1.1.47
Bumps [rickstaa/empty-issues-closer-action](https://github.com/rickstaa/empty-issues-closer-action) from 1.1.44 to 1.1.47.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/rickstaa/empty-issues-closer-action/releases">rickstaa/empty-issues-closer-action's releases</a>.</em></p>
<blockquote>
<p>v1.1.47: PR <a href="https://redirect.github.com/rickstaa/empty-issues-closer-action/issues/214">#214</a> - build(deps-dev): bump eslint from 8.53.0 to 8.54.0</p>
<p>v1.1.46: PR <a href="https://redirect.github.com/rickstaa/empty-issues-closer-action/issues/212">#212</a> - build(deps-dev): bump <code>@​typescript-eslint/parser</code> from 6.10.0 to 6.11.0</p>
<p>v1.1.45: PR <a href="https://redirect.github.com/rickstaa/empty-issues-closer-action/issues/213">#213</a> - build(deps-dev): bump <code>@​typescript-eslint/eslint-plugin</code> from 6.10.0 to 6.11.0</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/rickstaa/empty-issues-closer-action/commit/096c761b38032baf0e9e6bb65c17abf0615a6e41"><code>096c761</code></a> build(deps-dev): bump eslint from 8.53.0 to 8.54.0 (<a href="https://redirect.github.com/rickstaa/empty-issues-closer-action/issues/214">#214</a>)</li>
<li><a href="https://github.com/rickstaa/empty-issues-closer-action/commit/813511de4b19f620ae2b96bc926e3e321a7c7a5c"><code>813511d</code></a> build(deps-dev): bump <code>@​typescript-eslint/parser</code> from 6.10.0 to 6.11.0 (<a href="https://redirect.github.com/rickstaa/empty-issues-closer-action/issues/212">#212</a>)</li>
<li><a href="https://github.com/rickstaa/empty-issues-closer-action/commit/3db074c05bc219fe0e029b574407ad74d8fec374"><code>3db074c</code></a> build(deps-dev): bump <code>@​typescript-eslint/eslint-plugin</code> (<a href="https://redirect.github.com/rickstaa/empty-issues-closer-action/issues/213">#213</a>)</li>
<li>See full diff in <a href="https://github.com/rickstaa/empty-issues-closer-action/compare/1e7541f3bb442b6df5fe07e8cc2f5184076f2246...096c761b38032baf0e9e6bb65c17abf0615a6e41">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=rickstaa/empty-issues-closer-action&package-manager=github_actions&previous-version=1.1.44&new-version=1.1.47)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

vercel[bot]: [vc]: #l0/EES8IyEL1Xe1/6T7nudkh1fODo/GfD/DnbRRZqMU=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJnaXRodWItcmVhZG1lLXN0YXRzIiwicm9vdERpcmVjdG9yeSI6bnVsbCwiaW5zcGVjdG9yVXJsIjoiaHR0cHM6Ly92ZXJjZWwuY29tL2dpdGh1Yi1yZWFkbWUtc3RhdHMtdGVhbS9naXRodWItcmVhZG1lLXN0YXRzL0NKRHdSMnp2SnB0alhRaFZWcUtaZktjV2d3TlYiLCJwcmV2aWV3VXJsIjoiZ2l0aHViLXJlYWRtZS1zdGF0cy1naXQtZGVwZW5kYS0wN2Q1MGItZ2l0aHViLXJlYWRtZS1zdGF0cy10ZWFtLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiUEVORElORyJ9XX0=
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Updated (UTC) |
| :--- | :----- | :------ | :------ |
| **github-readme-stats** | 🔄 Building ([Inspect](https://vercel.com/github-readme-stats-team/github-readme-stats/CJDwR2zvJptjXQhVVqKZfKcWgwNV)) | [Visit Preview](https://github-readme-stats-git-dependa-07d50b-github-readme-stats-team.vercel.app) | Nov 20, 2023 6:05pm |



Patch:
diff --git a/.github/workflows/empty-issues-closer.yaml b/.github/workflows/empty-issues-closer.yaml
index eb94acf..6fdf59a 100644
--- a/.github/workflows/empty-issues-closer.yaml
+++ b/.github/workflows/empty-issues-closer.yaml
@@ -30,7 +30,7 @@ jobs:
       - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
 
       - name: Run empty issues closer action
-        uses: rickstaa/empty-issues-closer-action@1e7541f3bb442b6df5fe07e8cc2f5184076f2246 # v1.1.44
+        uses: rickstaa/empty-issues-closer-action@096c761b38032baf0e9e6bb65c17abf0615a6e41 # v1.1.47
         env:
           github_token: ${{ secrets.GITHUB_TOKEN }}
         with:
diff --git a/api/pin.js b/api/pin.js
index c67df29..0bc029d 100644
--- a/api/pin.js
+++ b/api/pin.js
@@ -24,6 +24,7 @@ export default async (req, res) => {
     locale,
     border_radius,
     border_color,
+    description_lines_count,
   } = req.query;
 
   res.setHeader("Content-Type", "image/svg+xml");
@@ -96,6 +97,7 @@ export default async (req, res) => {
         border_color,
         show_owner: parseBoolean(show_owner),
         locale: locale ? locale.toLowerCase() : null,
+        description_lines_count,
       }),
     );
   } catch (err) {
diff --git a/readme.md b/readme.md
index a176615..0f10671 100644
--- a/readme.md
+++ b/readme.md
@@ -386,6 +386,7 @@ If we don't support your language, please consider contributing! You can find mo
 #### Repo Card Exclusive Options
 
 *   `show_owner` - Shows the repo's owner name *(boolean)*. Default: `false`.
+*   `description_lines_count` - Manually set the number of lines for the description *(number)*. Specified value will be clamped between 1 and 3. If this parameter is not specified, the number of lines will be automatically adjusted according to the actual length of the description. Default: `undefined`.
 
 #### Gist Card Exclusive Options
 
diff --git a/src/cards/repo-card.js b/src/cards/repo-card.js
index 0d32475..bbfda52 100644
--- a/src/cards/repo-card.js
+++ b/src/cards/repo-card.js
@@ -12,10 +12,13 @@ import {
   wrapTextMultiline,
   iconWithLabel,
   createLanguageNode,
+  clampValue,
 } from "../common/utils.js";
 import { repoCardLocales } from "../translations.js";
 
 const ICON_SIZE = 16;
+const DESCRIPTION_LINE_WIDTH = 59;
+const DESCRIPTION_MAX_LINES = 3;
 
 /**
  * Retrieves the repository description and wraps it to fit the card width.
@@ -73,22 +76,34 @@ const renderRepoCard = (repo, options = {}) => {
     border_radius,
     border_color,
     locale,
+    description_lines_count,
   } = options;
 
   const lineHeight = 10;
   const header = show_owner ? nameWithOwner : name;
   const langName = (primaryLanguage && primaryLanguage.name) || "Unspecified";
   const langColor = (primaryLanguage && primaryLanguage.color) || "#333";
+  const descriptionMaxLines = description_lines_count
+    ? clampValue(description_lines_count, 1, DESCRIPTION_MAX_LINES)
+    : DESCRIPTION_MAX_LINES;
 
   const desc = parseEmojis(description || "No description provided");
-  const multiLineDescription = wrapTextMultiline(desc);
-  const descriptionLines = multiLineDescription.length;
+  const multiLineDescription = wrapTextMultiline(
+    desc,
+    DESCRIPTION_LINE_WIDTH,
+    descriptionMaxLines,
+  );
+  const descriptionLinesCount = description_lines_count
+    ? clampValue(description_lines_count, 1, DESCRIPTION_MAX_LINES)
+    : multiLineDescription.length;
+
   const descriptionSvg = multiLineDescription
     .map((line) => `<tspan dy="1.2em" x="25">${encodeHTML(line)}</tspan>`)
     .join("");
 
   const height =
-    (descriptionLines > 1 ? 120 : 110) + descriptionLines * lineHeight;
+    (descriptionLinesCount > 1 ? 120 : 110) +
+    descriptionLinesCount * lineHeight;
 
   const i18n = new I18n({
     locale,
diff --git a/src/cards/types.d.ts b/src/cards/types.d.ts
index dce964d..d55d1c6 100644
--- a/src/cards/types.d.ts
+++ b/src/cards/types.d.ts
@@ -32,6 +32,7 @@ export type StatCardOptions = CommonOptions & {
 
 export type RepoCardOptions = CommonOptions & {
   show_owner: boolean;
+  description_lines_count: number;
 };
 
 export type TopLangOptions = CommonOptions & {


Test patch:
diff --git a/tests/renderRepoCard.test.js b/tests/renderRepoCard.test.js
index 050e710..abbad4d 100644
--- a/tests/renderRepoCard.test.js
+++ b/tests/renderRepoCard.test.js
@@ -339,4 +339,34 @@ describe("Test renderRepoCard", () => {
       "No description provided",
     );
   });
+
+  it("should have correct height with specified `description_lines_count` parameter", () => {
+    // Testing short description
+    document.body.innerHTML = renderRepoCard(data_repo.repository, {
+      description_lines_count: 1,
+    });
+    expect(document.querySelector("svg")).toHaveAttribute("height", "120");
+    document.body.innerHTML = renderRepoCard(data_repo.repository, {
+      description_lines_count: 3,
+    });
+    expect(document.querySelector("svg")).toHaveAttribute("height", "150");
+
+    // Testing long description
+    const longDescription =
+      "A tool that will make a lot of iPhone/iPad developers' life easier. It shares your app over-the-air in a WiFi network. Bonjour is used and no configuration is needed.";
+    document.body.innerHTML = renderRepoCard(
+      { ...data_repo.repository, description: longDescription },
+      {
+        description_lines_count: 3,
+      },
+    );
+    expect(document.querySelector("svg")).toHaveAttribute("height", "150");
+    document.body.innerHTML = renderRepoCard(
+      { ...data_repo.repository, description: longDescription },
+      {
+        description_lines_count: 1,
+      },
+    );
+    expect(document.querySelector("svg")).toHaveAttribute("height", "120");
+  });
 });