Skip to content

Commit 432a30c

Browse files
authored
fix: revert fix enable-url-completion input (#310)
1 parent 0505d8b commit 432a30c

File tree

5 files changed

+13
-36
lines changed

5 files changed

+13
-36
lines changed

__test__/input-helper.unit.test.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.

action.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ inputs:
2222
description: >
2323
Enables completion of relative URLs to absolute ones
2424
Default: `false`
25-
default: "false"
2625
image-extensions:
2726
description: >
2827
File extensions that will be treated as images

dist/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function getInputs() {
128128
repository: core.getInput('repository'),
129129
shortDescription: core.getInput('short-description'),
130130
readmeFilepath: core.getInput('readme-filepath'),
131-
enableUrlCompletion: core.getBooleanInput('enable-url-completion'),
131+
enableUrlCompletion: Boolean(core.getInput('enable-url-completion')),
132132
imageExtensions: core.getInput('image-extensions')
133133
};
134134
// Environment variable input alternatives and their aliases
@@ -157,8 +157,7 @@ function getInputs() {
157157
inputs.readmeFilepath = process.env['README_FILEPATH'];
158158
}
159159
if (!inputs.enableUrlCompletion && process.env['ENABLE_URL_COMPLETION']) {
160-
inputs.enableUrlCompletion =
161-
process.env['ENABLE_URL_COMPLETION'].toLowerCase() === 'true';
160+
inputs.enableUrlCompletion = Boolean(process.env['ENABLE_URL_COMPLETION']);
162161
}
163162
if (!inputs.imageExtensions && process.env['IMAGE_EXTENSIONS']) {
164163
inputs.imageExtensions = process.env['IMAGE_EXTENSIONS'];
@@ -167,6 +166,9 @@ function getInputs() {
167166
if (!inputs.readmeFilepath) {
168167
inputs.readmeFilepath = readmeHelper.README_FILEPATH_DEFAULT;
169168
}
169+
if (!inputs.enableUrlCompletion) {
170+
inputs.enableUrlCompletion = readmeHelper.ENABLE_URL_COMPLETION_DEFAULT;
171+
}
170172
if (!inputs.imageExtensions) {
171173
inputs.imageExtensions = readmeHelper.IMAGE_EXTENSIONS_DEFAULT;
172174
}
@@ -311,12 +313,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
311313
});
312314
};
313315
Object.defineProperty(exports, "__esModule", ({ value: true }));
314-
exports.completeRelativeUrls = exports.getReadmeContent = exports.IMAGE_EXTENSIONS_DEFAULT = exports.README_FILEPATH_DEFAULT = void 0;
316+
exports.completeRelativeUrls = exports.getReadmeContent = exports.ENABLE_URL_COMPLETION_DEFAULT = exports.IMAGE_EXTENSIONS_DEFAULT = exports.README_FILEPATH_DEFAULT = void 0;
315317
const core = __importStar(__nccwpck_require__(7484));
316318
const fs = __importStar(__nccwpck_require__(9896));
317319
const utils = __importStar(__nccwpck_require__(9277));
318320
exports.README_FILEPATH_DEFAULT = './README.md';
319321
exports.IMAGE_EXTENSIONS_DEFAULT = 'bmp,gif,jpg,jpeg,png,svg,webp';
322+
exports.ENABLE_URL_COMPLETION_DEFAULT = false;
320323
const TITLE_REGEX = `(?: +"[^"]+")?`;
321324
const REPOSITORY_URL = `${process.env['GITHUB_SERVER_URL']}/${process.env['GITHUB_REPOSITORY']}`;
322325
const BLOB_PREFIX = `${REPOSITORY_URL}/blob/${process.env['GITHUB_REF_NAME']}/`;

src/input-helper.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function getInputs(): Inputs {
1818
repository: core.getInput('repository'),
1919
shortDescription: core.getInput('short-description'),
2020
readmeFilepath: core.getInput('readme-filepath'),
21-
enableUrlCompletion: core.getBooleanInput('enable-url-completion'),
21+
enableUrlCompletion: Boolean(core.getInput('enable-url-completion')),
2222
imageExtensions: core.getInput('image-extensions')
2323
}
2424

@@ -54,8 +54,7 @@ export function getInputs(): Inputs {
5454
}
5555

5656
if (!inputs.enableUrlCompletion && process.env['ENABLE_URL_COMPLETION']) {
57-
inputs.enableUrlCompletion =
58-
process.env['ENABLE_URL_COMPLETION'].toLowerCase() === 'true'
57+
inputs.enableUrlCompletion = Boolean(process.env['ENABLE_URL_COMPLETION'])
5958
}
6059

6160
if (!inputs.imageExtensions && process.env['IMAGE_EXTENSIONS']) {
@@ -66,6 +65,9 @@ export function getInputs(): Inputs {
6665
if (!inputs.readmeFilepath) {
6766
inputs.readmeFilepath = readmeHelper.README_FILEPATH_DEFAULT
6867
}
68+
if (!inputs.enableUrlCompletion) {
69+
inputs.enableUrlCompletion = readmeHelper.ENABLE_URL_COMPLETION_DEFAULT
70+
}
6971
if (!inputs.imageExtensions) {
7072
inputs.imageExtensions = readmeHelper.IMAGE_EXTENSIONS_DEFAULT
7173
}

src/readme-helper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as utils from './utils'
44

55
export const README_FILEPATH_DEFAULT = './README.md'
66
export const IMAGE_EXTENSIONS_DEFAULT = 'bmp,gif,jpg,jpeg,png,svg,webp'
7+
export const ENABLE_URL_COMPLETION_DEFAULT = false
78

89
const TITLE_REGEX = `(?: +"[^"]+")?`
910
const REPOSITORY_URL = `${process.env['GITHUB_SERVER_URL']}/${process.env['GITHUB_REPOSITORY']}`

0 commit comments

Comments
 (0)