Skip to content

Commit 597d23d

Browse files
committed
fix(action/file_name): replace all instances of slash
not just a single instance
1 parent 889e403 commit 597d23d

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/action.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,9 @@ const createIssues = async (octokit, context, maxOpenedIssues, labels, users, co
258258
for (let i = 0; i < numOfIssuesToCreate; i++) {
259259
const slug = componentsCandidatesToCreateIssue[i];
260260
const issueTitle = erroredComponents.includes(slug) ? `Failure Detected in \`${slug}\`` : `Drift Detected in \`${slug}\``;
261-
const file_name = slug.replace("/", "_")
262-
// Before we read the issue description, test that the file exists
261+
const file_name = slug.replace(/\//g, "_")
263262
if (!fs.existsSync(`issue-description-${file_name}.md`)) {
264-
core.error(`Failed to create issue for component ${slug} because issue description file issue-description-${file_name}.md does not exist`);
263+
core.error(`Failed to create issue for component ${slug} because file "issue-description-${file_name}.md" does not exist`);
265264
continue;
266265
}
267266
const issueDescription = fs.readFileSync(`issue-description-${file_name}.md`, 'utf8');
@@ -304,7 +303,7 @@ const updateIssues = async (octokit, context, componentsToIssues, componentsToUp
304303

305304
for (let i = 0; i < componentsToUpdateExistingIssue.length; i++) {
306305
const slug = componentsToUpdateExistingIssue[i];
307-
const file_name = slug.replace("/", "_")
306+
const file_name = slug.replace(/\//g, "_")
308307
const issueDescription = fs.readFileSync(`issue-description-${file_name}.md`, 'utf8');
309308
const issueNumber = componentsToIssues[slug].number;
310309

@@ -395,7 +394,7 @@ const postStepSummaries = async (driftingComponents, erroredComponents) => {
395394
const components = driftingComponents.concat(erroredComponents)
396395
for (let i = 0; i < components.length; i++) {
397396
const slug = components[i];
398-
const file_name = slug.replace("/", "_")
397+
const file_name = slug.replace(/\//g, "_")
399398
const file = `step-summary-${file_name}.md`;
400399
const content = fs.readFileSync(file, 'utf-8');
401400

0 commit comments

Comments
 (0)