From aa8fa3ff4e4ceff41322eec2e30e8ce78bd23dc6 Mon Sep 17 00:00:00 2001 From: Elliot Iddon Date: Sat, 3 Sep 2022 17:50:47 +0100 Subject: [PATCH] Fix edge case where substring could leave trailing seperators --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index fe42dad..2c17cb4 100644 --- a/index.js +++ b/index.js @@ -25,13 +25,15 @@ try { // Remove invalid characters result = result.replaceAll(/[^a-zA-Z0-9\._-]/g, '') - // Remove start and end periods and dashes + // Remove starting end periods and dashes result = result.replace(/^[-\.]+/, '') - result = result.replace(/[-\.]+$/, '') // Maximum of 128 characters result = result.substr(0, 128) + // Remove ending periods and dashes + result = result.replace(/[-\.]+$/, '') + core.setOutput('tag-name', result); } } catch (error) {