refactor: improve imports (#217)

* refactor: improve imports

Signed-off-by: Ardalan Amini <[email protected]>

* ci: fix release workflow

Signed-off-by: Ardalan Amini <[email protected]>

* 📝 Add docstrings to `refactor/improve-imports` (#218)

* 📝 Add docstrings to `refactor/improve-imports`

Docstrings generation was requested by @ardalanamini.

* https://github.com/ardalanamini/auto-changelog/pull/217#issuecomment-2953761296

The following files were modified:

* `src/changelog.ts`
* `src/footer.ts`
* `src/generate.ts`
* `src/inputs/commit-types.ts`
* `src/inputs/default-commit-type.ts`
* `src/inputs/github-token.ts`
* `src/inputs/include-commit-links.ts`
* `src/inputs/include-compare-link.ts`
* `src/inputs/include-pr-links.ts`
* `src/inputs/mention-authors.ts`
* `src/inputs/mention-new-contributors.ts`
* `src/inputs/release-name-prefix.ts`
* `src/inputs/release-name.ts`
* `src/inputs/semver.ts`
* `src/inputs/use-github-autolink.ts`
* `src/outputs/set-changelog.ts`
* `src/outputs/set-prerelease.ts`
* `src/outputs/set-release-id.ts`
* `src/utils/octokit.ts`

* Update changelog.ts

Signed-off-by: Ardalan Amini <[email protected]>

* style: address linter errors

Signed-off-by: Ardalan Amini <[email protected]>

---------

Signed-off-by: Ardalan Amini <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Ardalan Amini <[email protected]>

---------

Signed-off-by: Ardalan Amini <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Ardalan Aminiandcoderabbitai[bot] authored and GitHub committed 2025-06-08 12:29:09 +03:30
1 parent 99fcfc116e
commit f54a10a737
66 files changed
+238 -121

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getInput } from "@actions/core";
import { commitTypes } from "../../src/inputs";
import { commitTypes } from "#inputs";
it("should get and parse the \"commit-types\" input", () => {
const inputValue = `
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getInput } from "@actions/core";
import { defaultCommitType } from "../../src/inputs";
import { defaultCommitType } from "#inputs";
it("should get and parse the \"default-commit-type\" input", () => {
const inputValue = "Other Changes";
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getInput } from "@actions/core";
import { gitHubToken } from "../../src/inputs";
import { gitHubToken } from "#inputs";
it("should get and parse the \"github-token\" input", () => {
const inputValue = "github-token-value";
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getBooleanInput } from "@actions/core";
import { includeCommitLinks } from "../../src/inputs";
import { includeCommitLinks } from "#inputs";
it.each([true, false])("should get and parse the \"include-commit-links\" input as %j", (inputValue) => {
jest.mocked(getBooleanInput).mockReturnValueOnce(inputValue);
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getBooleanInput } from "@actions/core";
import { includeCompareLink } from "../../src/inputs";
import { includeCompareLink } from "#inputs";
it.each([true, false])("should get and parse the \"include-compare-link\" input as %j", (inputValue) => {
jest.mocked(getBooleanInput).mockReturnValueOnce(inputValue);
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getBooleanInput } from "@actions/core";
import { includePRLinks } from "../../src/inputs";
import { includePRLinks } from "#inputs";
it.each([true, false])("should retrieve the \"include-pr-links\" input as %j", (inputValue) => {
jest.mocked(getBooleanInput).mockReturnValueOnce(inputValue);
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getBooleanInput } from "@actions/core";
import { mentionAuthors } from "../../src/inputs";
import { mentionAuthors } from "#inputs";
it.each([true, false])("should get and parse the \"mention-authors\" input as %j", (inputValue) => {
jest.mocked(getBooleanInput).mockReturnValueOnce(inputValue);
@@ -23,7 +23,7 @@
*/
import { getBooleanInput } from "@actions/core";
import { mentionNewContributors } from "../../src/inputs";
import { mentionNewContributors } from "#inputs";
it.each([true, false])("should get and parse the \"mention-new-contributors\" input as %j", (inputValue) => {
jest.mocked(getBooleanInput).mockReturnValueOnce(inputValue);
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getInput } from "@actions/core";
import { releaseNamePrefix } from "../../src/inputs";
import { releaseNamePrefix } from "#inputs";
it("should get and parse the \"release-name-prefix\" input", () => {
const inputValue = "@actions/github/";
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getInput } from "@actions/core";
import { releaseName } from "../../src/inputs";
import { releaseName } from "#inputs";
it("should get and parse the \"release-name\" input", () => {
const inputValue = "v1.0.0";
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getBooleanInput } from "@actions/core";
import { semver } from "../../src/inputs";
import { semver } from "#inputs";
it.each([true, false])("should get and parse the \"semver\" input as %j", (inputValue) => {
jest.mocked(getBooleanInput).mockReturnValueOnce(inputValue);
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getBooleanInput } from "@actions/core";
import { useGitHubAutolink } from "../../src/inputs";
import { useGitHubAutolink } from "#inputs";
it.each([true, false])("should retrieve the \"use-github-autolink\" input as %j", (inputValue) => {
jest.mocked(getBooleanInput).mockReturnValueOnce(inputValue);
+1 -1
View File
@@ -22,6 +22,6 @@
* SOFTWARE.
*/
import { clearCache } from "../../src/utils";
import { clearCache } from "#utils";
afterEach(() => clearCache());
+1 -1
View File
@@ -25,7 +25,7 @@
import { getBooleanInput, getInput } from "@actions/core";
import { context } from "@actions/github";
import YAML from "yaml";
import { ChangelogNode, CommitNode, ScopeNode, TypeNode } from "../../src/nodes";
import { ChangelogNode, CommitNode, ScopeNode, TypeNode } from "#nodes";
const repo = {
owner: "ardalanamini",
+1 -1
View File
@@ -24,7 +24,7 @@
import { getBooleanInput } from "@actions/core";
import { context } from "@actions/github";
import { CommitAuthorNode, CommitHashNode, Node, PullRequestNode } from "../../src/nodes";
import { CommitAuthorNode, CommitHashNode, Node, PullRequestNode } from "#nodes";
const repo = {
owner: "ardalanamini",
+1 -1
View File
@@ -24,7 +24,7 @@
import { getBooleanInput } from "@actions/core";
import { context } from "@actions/github";
import { CommitHashNode, Node } from "../../src/nodes";
import { CommitHashNode, Node } from "#nodes";
const repo = {
owner: "ardalanamini",
+1 -1
View File
@@ -24,7 +24,7 @@
import { getBooleanInput } from "@actions/core";
import { context } from "@actions/github";
import { CommitAuthorNode, CommitHashNode, CommitNode, Node } from "../../src/nodes";
import { CommitAuthorNode, CommitHashNode, CommitNode, Node } from "#nodes";
const repo = {
owner: "ardalanamini",
+1 -1
View File
@@ -24,7 +24,7 @@
import { getBooleanInput } from "@actions/core";
import { context } from "@actions/github";
import { Node } from "../../src/nodes";
import { Node } from "#nodes";
it("should create an instance with common values", () => {
const shouldUseGithubAutolink = true;
+1 -1
View File
@@ -24,7 +24,7 @@
import { getBooleanInput } from "@actions/core";
import { context } from "@actions/github";
import { Node, PullRequestNode } from "../../src/nodes";
import { Node, PullRequestNode } from "#nodes";
const repo = {
owner: "ardalanamini",
+1 -1
View File
@@ -24,7 +24,7 @@
import { getBooleanInput } from "@actions/core";
import { context } from "@actions/github";
import { CommitNode, Node, ScopeNode } from "../../src/nodes";
import { CommitNode, Node, ScopeNode } from "#nodes";
const repo = {
owner: "ardalanamini",
+1 -1
View File
@@ -24,7 +24,7 @@
import { getBooleanInput } from "@actions/core";
import { context } from "@actions/github";
import { CommitNode, Node, ScopeNode, TypeNode } from "../../src/nodes";
import { CommitNode, Node, ScopeNode, TypeNode } from "#nodes";
const repo = {
owner: "ardalanamini",
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { info, setOutput } from "@actions/core";
import { setChangelog } from "../../src/outputs";
import { setChangelog } from "#outputs";
it("should log and set the changelog output", () => {
const outputValue = "Changelog Value";
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { info, setOutput } from "@actions/core";
import { setPrerelease } from "../../src/outputs";
import { setPrerelease } from "#outputs";
it.each([true, false])("should output \"prerelease\" value as %j", (outputValue) => {
setPrerelease(outputValue);
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { info, setOutput } from "@actions/core";
import { setReleaseId } from "../../src/outputs";
import { setReleaseId } from "#outputs";
it("should output \"release-id\" value", () => {
const outputName = "release-id";
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getBooleanInput } from "@actions/core";
import { booleanInput, cache } from "../../src/utils";
import { booleanInput, cache } from "#utils";
it("should get and parse a boolean input", () => {
const inputName = "foo";
+1 -1
View File
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
import { cache, clearCache } from "../../src/utils";
import { cache, clearCache } from "#utils";
it("should cache value", () => {
const name = "foo";
+1 -1
View File
@@ -26,7 +26,7 @@ import { getInput } from "@actions/core";
import { getOctokit } from "@actions/github";
import { GitHub } from "@actions/github/lib/utils";
import fetchMock from "fetch-mock";
import { iterateCommits } from "../../src/utils";
import { iterateCommits } from "#utils";
it("should iterate over commits", async () => {
const repo = {
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getInput } from "@actions/core";
import { cache, input } from "../../src/utils";
import { cache, input } from "#utils";
it("should get input value", () => {
const name = "foo";
+1 -1
View File
@@ -25,7 +25,7 @@
import { getInput } from "@actions/core";
import { getOctokit } from "@actions/github";
import { GitHub } from "@actions/github/lib/utils";
import { octokit } from "../../src/utils";
import { octokit } from "#utils";
it("should get octokit instance", () => {
const gitHubTokenInputName = "github-token";
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { info, setOutput } from "@actions/core";
import { output } from "../../src/utils";
import { output } from "#utils";
it("should output value", () => {
const name = "foo";
+1 -1
View File
@@ -23,7 +23,7 @@
*/
/* eslint-disable no-undefined */
import { parseCommitMessage } from "../../src/utils";
import { parseCommitMessage } from "#utils";
describe("acceptable commit message formats", () => {
it("should parse the commit message with breaking false", () => {
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { getInput } from "@actions/core";
import { parseSemanticVersion } from "../../src/utils";
import { parseSemanticVersion } from "#utils";
it("should parse the semver version string", () => {
const major = 1;
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { context } from "@actions/github";
import { repository } from "../../src/utils";
import { repository } from "#utils";
it("should get the repository information with constructed URL", () => {
const repo = {
+1 -1
View File
@@ -23,7 +23,7 @@
*/
import { context } from "@actions/github";
import { sha } from "../../src/utils";
import { sha } from "#utils";
it("should get the current commit sha", () => {
const shaValue = "3c1177539c1a216084f922ea52e56dd719a25945";
+1 -1
View File
@@ -22,7 +22,7 @@
* SOFTWARE.
*/
import { trim } from "../../src/utils/trim.js";
import { trim } from "#utils";
it("should remove leading and trailing whitespace", () => {
expect(trim(" hello ")).toBe("hello");