Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds support for a debug input in the release action #23

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions semantic-release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ----------------------------------------- |
| branches | Override the branches where semantic release runs on | `false` | |
| ci | Set to false to skip Continuous Integration environment verifications | `false` | |
| debug | Whether to run semantic release in `debug` mode | `false` | |
| dry-run | Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file | `false` | |
| extra-plugins | Extra plugins for pre-install. You can also specify specifying version range for the extra plugins if you prefer. Defaults to install @open-turo/semantic-release-config. | `false` | @open-turo/semantic-release-config@^1.4.0 |
| github-token | GitHub token that can checkout the repository as well as create tags/releases against it. e.g. 'secrets.GITHUB_TOKEN' | `true` | |
Expand Down
4 changes: 4 additions & 0 deletions semantic-release/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ inputs:
ci:
required: false
description: "Set to false to skip Continuous Integration environment verifications"
debug:
required: false
description: "Set to true to output debug logs"
dry-run:
required: false
description: "Whether to run semantic release in `dry-run` mode. It will override the dryRun attribute in your configuration file"
Expand Down Expand Up @@ -67,6 +70,7 @@ runs:
env:
GITHUB_TOKEN: ${{ inputs.github-token }}
SEMANTIC_ACTION_DRY_RUN: ${{ inputs.dry-run }}
SEMANTIC_ACTION_DEBUG: ${{ inputs.debug }}
SEMANTIC_ACTION_EXTRA_PLUGINS: ${{ inputs.extra-plugins }}
SEMANTIC_ACTION_BRANCHES: ${{ inputs.branches }}
SEMANTIC_ACTION_SEMANTIC_VERSION: ${{ inputs.semantic-version }}
2 changes: 1 addition & 1 deletion semantic-release/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion semantic-release/dist/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions semantic-release/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const OUTPUTS = {
interface Inputs {
branches?: string;
ci: boolean;
debug: boolean;
dryRun: boolean;
extraPlugins: string[];
semanticVersion?: string;
Expand Down Expand Up @@ -71,6 +72,7 @@ function getInputs(): Inputs {
branches: process.env.SEMANTIC_ACTION_BRANCHES || undefined,
ci: process.env.SEMANTIC_ACTION_CI === "true",
dryRun: process.env.SEMANTIC_ACTION_DRY_RUN === "true",
debug: process.env.SEMANTIC_ACTION_DEBUG === "true",
extraPlugins: (process.env.SEMANTIC_ACTION_EXTRA_PLUGINS || "")
.replaceAll(/["']/g, "")
.replaceAll(/[\n\r]/g, " ")
Expand Down Expand Up @@ -118,6 +120,7 @@ export async function main() {
Object.entries({
branches: inputs.branches,
ci: inputs.ci,
debug: inputs.debug,
dryRun: inputs.dryRun,
}).filter(([, value]) => value !== undefined && value !== null),
),
Expand Down
4 changes: 4 additions & 0 deletions semantic-release/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ describe("semantic-release", () => {
jest.resetAllMocks();
delete process.env.SEMANTIC_ACTION_BRANCHES;
delete process.env.SEMANTIC_ACTION_CI;
delete process.env.SEMANTIC_ACTION_DEBUG;
delete process.env.SEMANTIC_ACTION_DRY_RUN;
delete process.env.SEMANTIC_ACTION_EXTRA_PLUGINS;
delete process.env.SEMANTIC_ACTION_SEMANTIC_VERSION;
Expand All @@ -102,6 +103,7 @@ describe("semantic-release", () => {
expect(semanticReleaseMock.mock.calls[0][0]).toMatchInlineSnapshot(`
{
"ci": false,
"debug": false,
"dryRun": false,
}
`);
Expand Down Expand Up @@ -150,6 +152,7 @@ describe("semantic-release", () => {
test("runs semantic release with the extra options", async () => {
process.env.SEMANTIC_ACTION_BRANCHES = "test";
process.env.SEMANTIC_ACTION_CI = "true";
process.env.SEMANTIC_ACTION_DEBUG = "true";
process.env.SEMANTIC_ACTION_DRY_RUN = "true";
mockNpmInstall();
mockRelease({ nextRelease: undefined });
Expand All @@ -159,6 +162,7 @@ describe("semantic-release", () => {
{
"branches": "test",
"ci": true,
"debug": true,
"dryRun": true,
}
`);
Expand Down
Loading