Skip to content

Commit

Permalink
fix(action/file_name): replace all instances of slash
Browse files Browse the repository at this point in the history
not just a single instance
  • Loading branch information
dudymas committed Dec 23, 2023
1 parent 889e403 commit 597d23d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,9 @@ const createIssues = async (octokit, context, maxOpenedIssues, labels, users, co
for (let i = 0; i < numOfIssuesToCreate; i++) {
const slug = componentsCandidatesToCreateIssue[i];
const issueTitle = erroredComponents.includes(slug) ? `Failure Detected in \`${slug}\`` : `Drift Detected in \`${slug}\``;
const file_name = slug.replace("/", "_")
// Before we read the issue description, test that the file exists
const file_name = slug.replace(/\//g, "_")
if (!fs.existsSync(`issue-description-${file_name}.md`)) {
core.error(`Failed to create issue for component ${slug} because issue description file issue-description-${file_name}.md does not exist`);
core.error(`Failed to create issue for component ${slug} because file "issue-description-${file_name}.md" does not exist`);
continue;
}
const issueDescription = fs.readFileSync(`issue-description-${file_name}.md`, 'utf8');
Expand Down Expand Up @@ -304,7 +303,7 @@ const updateIssues = async (octokit, context, componentsToIssues, componentsToUp

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

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

Expand Down

0 comments on commit 597d23d

Please sign in to comment.