Skip to content

Commit a1b382a

Browse files
authored
Merge pull request #91 from github/jtamsut/remove-newlines-from-names
Remove newline characters from workflow run names
2 parents cd8c282 + 6f5a024 commit a1b382a

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/treeViews/currentBranch.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ export class CurrentBranchTreeProvider
112112

113113
const resp = result.data;
114114
const runs = resp.workflow_runs;
115+
// We are removing newlines from workflow names for presentation purposes
116+
for (const run of runs) {
117+
run.name = run.name?.replace(/(\r\n|\n|\r)/gm, " ");
118+
}
115119

116120
return this.runNodes(gitHubRepoContext, runs, true);
117121
}

src/treeViews/workflows/workflowsRepoNode.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export async function getWorkflowNodes(gitHubRepoContext: GitHubRepoContext) {
3636
workflows.map(async wf => {
3737
const workflowUri = getWorkflowUri(gitHubRepoContext, wf.path);
3838
const workflowContext = await getContextStringForWorkflow(workflowUri);
39+
const nameWithoutNewlines = wf.name.replace(/(\r\n|\n|\r)/gm, " ");
40+
41+
// We are removing all newline characters from the workflow name for presentation purposes
42+
wf.name = nameWithoutNewlines;
3943

4044
return new WorkflowNode(gitHubRepoContext, wf, workflowContext);
4145
})

0 commit comments

Comments
 (0)