Skip to content

Commit 7a8f844

Browse files
committed
Change scope of variables
1 parent f45b908 commit 7a8f844

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/main/java/org/jenkinsci/plugins/ghprb/extensions/comments/GhprbCommentFile.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,6 @@ public String postBuildComment(Run<?, ?> build, TaskListener listener) {
5151

5252
try {
5353
String content = null;
54-
FilePath workspace;
55-
FilePath path;
56-
5754
// On custom pipelines, build will be an instance of WorkflowRun
5855
if (build instanceof WorkflowRun) {
5956
FlowExecution exec = ((WorkflowRun) build).getExecution();
@@ -76,7 +73,7 @@ public String postBuildComment(Run<?, ?> build, TaskListener listener) {
7673
continue;
7774
}
7875

79-
path = action.getWorkspace().child(scriptFilePathResolved);
76+
FilePath path = action.getWorkspace().child(scriptFilePathResolved);
8077

8178
if (path.exists()) {
8279
content = path.readToString();
@@ -93,8 +90,8 @@ public String postBuildComment(Run<?, ?> build, TaskListener listener) {
9390
}
9491
} else if (build instanceof Build<?, ?>) {
9592
// When using workers on hosts other than master, we simply get the workspace here.
96-
workspace = ((Build<?, ?>) build).getWorkspace();
97-
path = workspace.child(scriptFilePathResolved);
93+
FilePath workspace = ((Build<?, ?>) build).getWorkspace();
94+
FilePath path = workspace.child(scriptFilePathResolved);
9895

9996
if (path.exists()) {
10097
content = path.readToString();

0 commit comments

Comments
 (0)