Compare commits

...

6 Commits
0.0.7 ... 0.1.2

Author SHA1 Message Date
094c4c7b0f chore(deps): update dependencies (non-major) (#18)
All checks were successful
CD / Release (push) Successful in 45s
This PR contains the following updates:

| Package | Type | Update | Change | Pending |
|---|---|---|---|---|
| [jest](https://jestjs.io/) ([source](https://github.com/jestjs/jest/tree/HEAD/packages/jest)) | devDependencies | minor | [`30.1.3` -> `30.2.0`](https://renovatebot.com/diffs/npm/jest/30.1.3/30.2.0) |  |
| [ts-jest](https://kulshekhar.github.io/ts-jest) ([source](https://github.com/kulshekhar/ts-jest)) | devDependencies | patch | [`29.4.2` -> `29.4.4`](https://renovatebot.com/diffs/npm/ts-jest/29.4.2/29.4.4) | `29.4.5` |

---

### Release Notes

<details>
<summary>jestjs/jest (jest)</summary>

### [`v30.2.0`](https://github.com/jestjs/jest/blob/HEAD/CHANGELOG.md#3020)

[Compare Source](https://github.com/jestjs/jest/compare/v30.1.3...v30.2.0)

##### Chore & Maintenance

- `[*]` Update example repo for testing React Native projects ([#&#8203;15832](https://github.com/jestjs/jest/pull/15832))
- `[*]` Update `jest-watch-typeahead` to v3 ([#&#8203;15830](https://github.com/jestjs/jest/pull/15830))

</details>

<details>
<summary>kulshekhar/ts-jest (ts-jest)</summary>

### [`v29.4.4`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2944-2025-09-19)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v29.4.3...v29.4.4)

##### Bug Fixes

- revert **29.4.3** changes ([25cb706](25cb706552)), closes [#&#8203;5049](https://github.com/kulshekhar/ts-jest/issues/5049)

### [`v29.4.3`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2944-2025-09-19)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v29.4.2...v29.4.3)

##### Bug Fixes

- revert **29.4.3** changes ([25cb706](25cb706552)), closes [#&#8203;5049](https://github.com/kulshekhar/ts-jest/issues/5049)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMjQuMCIsInVwZGF0ZWRJblZlciI6IjQxLjEyNS4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment/pulls/18
Reviewed-by: t.behrendt <t.behrendt@noreply.localhost>
Co-authored-by: Renovate Bot <renovate@t00n.de>
Co-committed-by: Renovate Bot <renovate@t00n.de>
2025-10-13 07:53:52 +02:00
d3f0376d67 chore(deps): update dependencies (non-major) (#16)
All checks were successful
CD / Release (push) Successful in 12s
This PR contains the following updates:

| Package | Type | Update | Change | Pending |
|---|---|---|---|---|
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)) | devDependencies | minor | [`24.3.1` -> `24.5.2`](https://renovatebot.com/diffs/npm/@types%2fnode/24.3.1/24.5.2) | `24.6.2` (+2) |
| [esbuild](https://github.com/evanw/esbuild) | devDependencies | patch | [`0.25.9` -> `0.25.10`](https://renovatebot.com/diffs/npm/esbuild/0.25.9/0.25.10) |  |
| [ts-jest](https://kulshekhar.github.io/ts-jest) ([source](https://github.com/kulshekhar/ts-jest)) | devDependencies | patch | [`29.4.1` -> `29.4.2`](https://renovatebot.com/diffs/npm/ts-jest/29.4.1/29.4.2) | `29.4.4` (+1) |

---

### Release Notes

<details>
<summary>evanw/esbuild (esbuild)</summary>

### [`v0.25.10`](https://github.com/evanw/esbuild/blob/HEAD/CHANGELOG.md#02510)

[Compare Source](https://github.com/evanw/esbuild/compare/v0.25.9...v0.25.10)

- Fix a panic in a minification edge case ([#&#8203;4287](https://github.com/evanw/esbuild/issues/4287))

  This release fixes a panic due to a null pointer that could happen when esbuild inlines a doubly-nested identity function and the final result is empty. It was fixed by emitting the value `undefined` in this case, which avoids the panic. This case must be rare since it hasn't come up until now. Here is an example of code that previously triggered the panic (which only happened when minifying):

  ```js
  function identity(x) { return x }
  identity({ y: identity(123) })
  ```

- Fix `@supports` nested inside pseudo-element ([#&#8203;4265](https://github.com/evanw/esbuild/issues/4265))

  When transforming nested CSS to non-nested CSS, esbuild is supposed to filter out pseudo-elements such as `::placeholder` for correctness. The [CSS nesting specification](https://www.w3.org/TR/css-nesting-1/) says the following:

  > The nesting selector cannot represent pseudo-elements (identical to the behavior of the ':is()' pseudo-class). We’d like to relax this restriction, but need to do so simultaneously for both ':is()' and '&', since they’re intentionally built on the same underlying mechanisms.

  However, it seems like this behavior is different for nested at-rules such as `@supports`, which do work with pseudo-elements. So this release modifies esbuild's behavior to now take that into account:

  ```css
  /* Original code */
  ::placeholder {
    color: red;
    body & { color: green }
    @&#8203;supports (color: blue) { color: blue }
  }

  /* Old output (with --supported:nesting=false) */
  ::placeholder {
    color: red;
  }
  body :is() {
    color: green;
  }
  @&#8203;supports (color: blue) {
     {
      color: blue;
    }
  }

  /* New output (with --supported:nesting=false) */
  ::placeholder {
    color: red;
  }
  body :is() {
    color: green;
  }
  @&#8203;supports (color: blue) {
    ::placeholder {
      color: blue;
    }
  }
  ```

</details>

<details>
<summary>kulshekhar/ts-jest (ts-jest)</summary>

### [`v29.4.2`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#2942-2025-09-15)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v29.4.1...v29.4.2)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xMDcuMCIsInVwZGF0ZWRJblZlciI6IjQxLjEyNC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://gitea.t000-n.de/t.behrendt/conventional-semantic-git-tag-increment/pulls/16
Reviewed-by: t.behrendt <t.behrendt@noreply.localhost>
Co-authored-by: Renovate Bot <renovate@t00n.de>
Co-committed-by: Renovate Bot <renovate@t00n.de>
2025-10-02 08:02:24 +02:00
0e6aab82a5 feat: add ability to create pre-release tags (#17)
All checks were successful
CD / Release (push) Successful in 40s
Reviewed-on: #17
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
2025-09-30 17:29:47 +02:00
5b2f1fe9d4 chore(deps): update dependencies (non-major) (#13)
All checks were successful
CD / Release (push) Successful in 14s
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node) ([source](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node)) | devDependencies | patch | [`24.3.0` -> `24.3.1`](https://renovatebot.com/diffs/npm/@types%2fnode/24.3.0/24.3.1) |
| [jest](https://jestjs.io/) ([source](https://github.com/jestjs/jest/tree/HEAD/packages/jest)) | devDependencies | patch | [`30.1.1` -> `30.1.3`](https://renovatebot.com/diffs/npm/jest/30.1.1/30.1.3) |

---

### Release Notes

<details>
<summary>jestjs/jest (jest)</summary>

### [`v30.1.3`](https://github.com/jestjs/jest/blob/HEAD/CHANGELOG.md#3013)

[Compare Source](https://github.com/jestjs/jest/compare/v30.1.2...v30.1.3)

##### Fixes

- Fix `unstable_mockModule` with `node:` prefixed core modules.

### [`v30.1.2`](https://github.com/jestjs/jest/blob/HEAD/CHANGELOG.md#3012)

[Compare Source](https://github.com/jestjs/jest/compare/v30.1.1...v30.1.2)

##### Fixes

- `[jest-snapshot-utils]` Correct snapshot header regexp to work with newline across OSes ([#&#8203;15803](https://github.com/jestjs/jest/pull/15803))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS45Ni4yIiwidXBkYXRlZEluVmVyIjoiNDEuOTYuMiIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

Reviewed-on: #13
Reviewed-by: t.behrendt <t.behrendt@noreply.localhost>
Co-authored-by: Renovate Bot <renovate@t00n.de>
Co-committed-by: Renovate Bot <renovate@t00n.de>
2025-09-05 20:26:05 +02:00
a6e0311a4b chore: bump nodejs to 24 (#15)
All checks were successful
CD / Release (push) Successful in 41s
Reviewed-on: #15
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
2025-09-05 18:44:13 +02:00
37b7b07e3f ci: adjust renovate to group non-majors (#12)
All checks were successful
CD / Release (push) Successful in 43s
Reviewed-on: #12
Co-authored-by: t.behrendt <t.behrendt@t00n.de>
Co-committed-by: t.behrendt <t.behrendt@t00n.de>
2025-09-04 15:21:50 +02:00
11 changed files with 726 additions and 532 deletions

View File

@@ -63,3 +63,37 @@ jobs:
fi
echo "New tag: ${{ steps.increment-tag.outputs.new-tag }}"
dry-run-prerelease:
name: Dry-Run Prerelease
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: actions/setup-node@v5
with:
node-version-file: .nvmrc
- run: npm ci
- name: Create prerelease tag
id: prerelease-tag
uses: ./
with:
token: ${{ secrets.GITEA_TOKEN }}
prerelease: "true"
- name: Print new tag
run: |
if [ -z "${{ steps.prerelease-tag.outputs.new-tag }}" ]; then
echo "No new tag found"
exit 1
fi
echo "New tag: ${{ steps.prerelease-tag.outputs.new-tag }}"
- name: Verify prerelease tag format
run: |
if [[ "${{ steps.prerelease-tag.outputs.new-tag }}" =~ -rc-[a-f0-9]{7,}$ ]]; then
echo "✓ Prerelease tag format is correct"
else
echo "✗ Prerelease tag format is incorrect. Expected format: X.Y.Z-rc-<sha>"
exit 1
fi

2
.nvmrc
View File

@@ -1 +1 @@
v20
24

View File

@@ -43,6 +43,15 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
```
### With prerelease tags
```yaml
- uses: tbehrendt/conventional-semantic-git-tag-increment@v1
with:
prerelease: "true"
token: ${{ secrets.GITHUB_TOKEN }}
```
## Examples
| Commit Message | Current Tag | New Tag | Reason |
@@ -52,11 +61,20 @@ jobs:
| `feat!: change API response format` | `v1.1.1` | `v2.0.0` | Breaking change |
| `docs: update README` | `v2.0.0` | `v2.0.1` | Documentation update |
### Prerelease Examples
| Commit Message | Current Tag | New Tag (prerelease) | Reason |
| ------------------------------- | ----------- | -------------------- | ----------- |
| `feat: add user authentication` | `v1.0.0` | `1.1.0-rc-abc123` | New feature |
| `fix: resolve login bug` | `v1.1.0` | `1.1.1-rc-def456` | Bug fix |
## Inputs
- `last-tag` (optional): Starting tag to increment from. If not provided, uses the latest tag in the repository.
- `token` (required): GitHub token for repository access. Use `${{ github.token }}` for public repos or a PAT for private repos.
- `prerelease` (optional): Whether to create a prerelease tag with `-rc-<github.sha>` suffix. Defaults to `false`.
- `max-tags` (optional): Maximum number of tags to fetch when looking for the latest non-pre-release tag. Defaults to `50`.
## Outputs
- `new-tag`: The incremented semantic version tag (e.g., `1.2.3`)
- `new-tag`: The incremented semantic version tag (e.g., `1.2.3` or `1.2.3-rc-abc123` for prerelease)

View File

@@ -11,11 +11,19 @@ inputs:
description: "Token for repository access"
required: true
default: "${{ github.token }}"
prerelease:
description: "Whether to create a prerelease tag"
required: false
default: "false"
max-tags:
description: "Maximum number of tags to fetch when looking for the latest non-pre-release tag"
required: false
default: "50"
outputs:
new-tag:
description: "The new incremented git tag"
runs:
using: "node20"
using: "node24"
main: "dist/index.js"

64
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -1,12 +0,0 @@
import { build } from "esbuild";
await build({
entryPoints: ["src/index.ts"],
bundle: true,
platform: "node",
target: "node20",
outfile: "dist/index.js",
sourcemap: false,
minify: true,
logLevel: "info",
});

951
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@
"main": "src/index.ts",
"scripts": {
"typecheck": "tsc --noEmit",
"build": "esbuild src/index.ts --bundle --outfile=dist/index.js --platform=node --target=node20 --minify",
"build": "esbuild src/index.ts --bundle --outfile=dist/index.js --platform=node --target=node24 --minify",
"test": "jest",
"format": "prettier --write src/**/*.ts"
},

View File

@@ -1,3 +1,9 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"packageRules": [
{
"matchUpdateTypes": ["patch", "minor"],
"groupName": "dependencies (non-major)"
}
]
}

View File

@@ -149,6 +149,16 @@ describe("TagService", () => {
const result = tagService.renderTag(tag, "v");
expect(result).toBe("v1.2.3");
});
it("should render tag with prerelease suffix", () => {
const result = tagService.renderTag(tag, "", "-rc-abc123");
expect(result).toBe("1.2.3-rc-abc123");
});
it("should render tag with prefix and prerelease suffix", () => {
const result = tagService.renderTag(tag, "v", "-rc-abc123");
expect(result).toBe("v1.2.3-rc-abc123");
});
});
describe("parseTag", () => {
@@ -221,7 +231,7 @@ describe("TagIncrementer", () => {
const result = await tagIncrementer.getBaseTag(undefined);
expect(result).toBe("v2.0.0");
expect(mockCoreService.getLogs()).toContain("INFO: Using latest tag: v2.0.0");
expect(mockCoreService.getLogs()).toContain("INFO: Using latest real tag: v2.0.0");
});
it("should default to 0.0.0 when no tags found", async () => {
@@ -234,6 +244,34 @@ describe("TagIncrementer", () => {
"WARNING: No tags found in repository, defaulting to 0.0.0"
);
});
it("should skip pre-release tags and use latest real tag", async () => {
mockGitService.setMockTags([
{ name: "v2.0.0-rc-26035c6e13" },
{ name: "v1.2.3" },
{ name: "v1.1.4-rc-aa512edb16" },
{ name: "v1.0.0" },
]);
const result = await tagIncrementer.getBaseTag(undefined);
expect(result).toBe("v1.2.3");
expect(mockCoreService.getLogs()).toContain("INFO: Using latest real tag: v1.2.3");
});
it("should default to 0.0.0 when only pre-release tags found", async () => {
mockGitService.setMockTags([
{ name: "v2.0.0-rc-26035c6e13" },
{ name: "v1.1.4-rc-aa512edb16" },
]);
const result = await tagIncrementer.getBaseTag(undefined);
expect(result).toBe("0.0.0");
expect(mockCoreService.getWarnings()).toContain(
"WARNING: No real tags found (only pre-release tags), defaulting to 0.0.0"
);
});
});
describe("determineIncrementType", () => {
@@ -302,6 +340,28 @@ describe("TagIncrementer", () => {
expect(result).toBe("2.1.1");
});
it("should create prerelease tag when prerelease is true", async () => {
mockGitService.setMockTags([{ name: "v1.2.3" }]);
mockGitService.setMockCommit({
commit: { message: "feat: new feature" },
});
const result = await tagIncrementer.incrementTag(undefined, "ref", 50, true, "abc123");
expect(result).toBe("1.3.0-rc-abc123");
});
it("should not create prerelease tag when prerelease is false", async () => {
mockGitService.setMockTags([{ name: "v1.2.3" }]);
mockGitService.setMockCommit({
commit: { message: "feat: new feature" },
});
const result = await tagIncrementer.incrementTag(undefined, "ref", 50, false, "abc123");
expect(result).toBe("1.3.0");
});
});
});
@@ -315,14 +375,18 @@ describe("LocalGitService", () => {
describe("listTags", () => {
it("should call git command to list tags", async () => {
mockExecSync.mockReturnValue("v1.0.0\nv1.1.0\n" as any);
mockExecSync.mockReturnValue("v1.0.0\n1.1.0\n2.0.0-rc-26035c6e13\n" as any);
const result = await localGitService.listTags(5);
expect(mockExecSync).toHaveBeenCalledWith("git tag --sort=-version:refname", {
encoding: "utf8",
});
expect(result).toEqual([{ name: "v1.0.0" }, { name: "v1.1.0" }]);
expect(result).toEqual([
{ name: "v1.0.0" },
{ name: "1.1.0" },
{ name: "2.0.0-rc-26035c6e13" },
]);
});
it("should return empty array when no tags exist", async () => {
@@ -391,9 +455,12 @@ describe("LocalCoreService", () => {
// Integration test example
describe("TagIncrementer Integration", () => {
it("should handle complete tag increment flow", async () => {
const mockGitService = new MockGitService([{ name: "v1.2.3" }], {
commit: { message: "feat: new feature" },
});
const mockGitService = new MockGitService(
[{ name: "v2.0.0-rc-26035c6e13" }, { name: "v1.1.4-rc-aa512edb16" }, { name: "v1.2.3" }],
{
commit: { message: "feat: new feature" },
}
);
const mockCoreService = new MockCoreService();
const commitAnalyzer = new ConventionalCommitAnalyzer();
const tagService = new TagService();
@@ -410,5 +477,23 @@ describe("TagIncrementer Integration", () => {
expect(result).toBe("1.3.0");
expect(mockCoreService.getLogs()).toContain("INFO: Determined increment type: minor");
expect(mockCoreService.getLogs()).toContain("INFO: New tag: 1.3.0");
expect(mockCoreService.getLogs()).toContain("INFO: Using latest real tag: v1.2.3");
});
});
describe("Prerelease Validation", () => {
it("should validate prerelease configuration correctly", () => {
// Test cases for prerelease validation logic
const testCases = [
{ prerelease: true, githubSha: "abc123", shouldFail: false },
{ prerelease: true, githubSha: "", shouldFail: true },
{ prerelease: false, githubSha: "abc123", shouldFail: false },
{ prerelease: false, githubSha: "", shouldFail: false },
];
testCases.forEach(({ prerelease, githubSha, shouldFail }) => {
const result = prerelease && !githubSha;
expect(result).toBe(shouldFail);
});
});
});

View File

@@ -73,8 +73,8 @@ export class TagService {
}
}
renderTag(tag: Tag, prefix: string = ""): string {
return `${prefix}${tag.major}.${tag.minor}.${tag.patch}`;
renderTag(tag: Tag, prefix: string = "", prereleaseSuffix: string = ""): string {
return `${prefix}${tag.major}.${tag.minor}.${tag.patch}${prereleaseSuffix}`;
}
parseTag(tagString: string): Tag {
@@ -103,22 +103,29 @@ export class TagIncrementer {
private tagService: TagService
) {}
async getBaseTag(lastTag: string | undefined): Promise<string> {
async getBaseTag(lastTag: string | undefined, maxTags: number = 50): Promise<string> {
if (lastTag) {
this.coreService.info(`Using provided tag: ${lastTag}`);
return lastTag;
}
this.coreService.info("Fetching tags from local repository");
const tags = await this.gitService.listTags(1);
this.coreService.info(`Fetching up to ${maxTags} tags from local repository`);
const tags = await this.gitService.listTags(maxTags);
if (tags.length === 0) {
this.coreService.warning("No tags found in repository, defaulting to 0.0.0");
return "0.0.0";
}
const baseTag = tags[0].name;
this.coreService.info(`Using latest tag: ${baseTag}`);
const realTags = tags.filter((tag) => !tag.name.includes("-rc-"));
if (realTags.length === 0) {
this.coreService.warning("No real tags found (only pre-release tags), defaulting to 0.0.0");
return "0.0.0";
}
const baseTag = realTags[0].name;
this.coreService.info(`Using latest real tag: ${baseTag}`);
return baseTag;
}
@@ -155,10 +162,16 @@ export class TagIncrementer {
}
}
async incrementTag(lastTag: string | undefined, ref: string): Promise<string> {
async incrementTag(
lastTag: string | undefined,
ref: string,
maxTags: number = 50,
prerelease: boolean = false,
githubSha: string = ""
): Promise<string> {
this.coreService.info(`Starting tag increment process at ref ${ref}`);
const baseTag = await this.getBaseTag(lastTag);
const baseTag = await this.getBaseTag(lastTag, maxTags);
const parsedTag = this.tagService.parseTag(baseTag);
this.coreService.info(
@@ -168,7 +181,9 @@ export class TagIncrementer {
const incrementType = await this.determineIncrementType(ref);
const newTag = this.tagService.bumpTag(parsedTag, incrementType);
const renderedTag = this.tagService.renderTag(newTag);
const prereleaseSuffix = prerelease && githubSha ? `-rc-${githubSha}` : "";
const renderedTag = this.tagService.renderTag(newTag, "", prereleaseSuffix);
this.coreService.info(`New tag: ${renderedTag}`);
this.coreService.info(
@@ -242,12 +257,27 @@ export async function run(): Promise<void> {
const coreService = new LocalCoreService();
const lastTag = coreService.getInput("last-tag");
const maxTagsInput = coreService.getInput("max-tags");
const maxTags = parseInt(maxTagsInput || "50", 10);
const prereleaseInput = coreService.getInput("prerelease");
const prerelease = prereleaseInput === "true";
const githubSha = process.env.GITHUB_SHA || "";
const ref = "HEAD";
if (prerelease && !githubSha) {
const errorMessage =
"Prerelease is enabled but GITHUB_SHA environment variable is not available. This is required for prerelease tags.";
coreService.setFailed(errorMessage);
return;
}
// Log context information for debugging
coreService.info(`Working with local git repository`);
coreService.info(`Commit ref: ${ref}`);
coreService.info(`Last tag input: ${lastTag || "undefined"}`);
coreService.info(`Max tags limit: ${maxTags}`);
coreService.info(`Prerelease: ${prerelease}`);
coreService.info(`GitHub SHA: ${githubSha || "undefined"}`);
const gitService = new LocalGitService();
const commitAnalyzer = new ConventionalCommitAnalyzer();
@@ -261,7 +291,13 @@ export async function run(): Promise<void> {
await gitService.testConnection();
coreService.info("Git repository connection successful");
const newTag = await tagIncrementer.incrementTag(lastTag || undefined, ref);
const newTag = await tagIncrementer.incrementTag(
lastTag || undefined,
ref,
maxTags,
prerelease,
githubSha
);
coreService.info(`Process completed successfully. New tag: ${newTag}`);
coreService.setOutput("new-tag", newTag);