Skip to content

Commit

Permalink
[yegor256#1459] Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pnatashap committed Feb 8, 2024
1 parent 3e9a104 commit 499701b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
27 changes: 16 additions & 11 deletions src/main/java/com/rultor/agents/github/qtn/QnMerge.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,30 @@ public Req understand(final Comment.Smart comment,
issue.repo().coordinates(), issue.number(), comment.number()
);
final CheckablePull pull = new CheckablePull(issue.pull());
if (pull.containsFile(".rultor.yml")) {
final String sysfile = ".rultor.yml";
if (pull.containsFile(sysfile)) {
new Answer(comment).post(
false,
QnMerge.PHRASES
.getString("QnMerge.system-files-affected")
false,
String.format(
QnMerge.PHRASES.getString(
"QnMerge.system-files-affected"
),
sysfile
)
);
req = Req.DONE;
} else
if (pull.allChecksSuccessful()) {
new Answer(comment).post(
true,
String.format(
QnMerge.PHRASES.getString("QnMerge.start"),
home.toASCIIString()
)
true,
String.format(
QnMerge.PHRASES.getString("QnMerge.start"),
home.toASCIIString()
)
);
req = QnMerge.pack(
comment,
issue.repo().pulls().get(issue.number())
comment,
issue.repo().pulls().get(issue.number())
);
} else {
new Answer(comment).post(
Expand Down
7 changes: 5 additions & 2 deletions src/main/resources/phrases_en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,11 @@ QnMerge.checks-are-failed=Can't merge it. Some CI checks were failed. \
Apparently, the pull request is not ready to be \
merged since it has some problems. \
Please, fix them first.
QnMerge.system-files-affected=Can't merge it. File `.rultor.yml` is affected by \
this pull request.
QnMerge.system-files-affected=Can't merge this pull requests, because the file \
`%s` was modified. This is a security threat. \
Make a separate pull request with the \
modification of this particular file and ask \
project architect to merge it manually.

QnDeploy.start=OK, I'll try to deploy now. You can check the progress [here](%s)

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/rultor/agents/github/qtn/QnMergeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ public void stopsBecauseSystemFilesAffected()
MatcherAssert.assertThat(
new Comment.Smart(this.comments.get(2)).body(),
Matchers.containsString(
QnMergeTest.PHRASES.getString(
"QnMerge.system-files-affected"
)
QnMergeTest.PHRASES.getString(
"QnMerge.system-files-affected"
)
)
);
}
Expand Down

0 comments on commit 499701b

Please sign in to comment.