Skip to content

Commit 785a1eb

Browse files
authored
Fix failure of AzureCommentReporter when there is no pull request found in ENV vars (#2515)
* Fix failure of AzureCommentReporter when there is no pull request found in ENV vars * [MegaLinter] Apply linters fixes --------- Co-authored-by: nvuillam <[email protected]>
1 parent fe568b3 commit 785a1eb

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
1515
- Linter enhancements & fixes
1616

1717
- Core
18+
- Fix failure of AzureCommentReporter when there is no pull request found in ENV vars
1819

1920
- Documentation
2021

docs/descriptors/xml_xmllint.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To apply file formatting you must set `XML_XMLLINT_CLI_LINT_MODE: file` and `XML
2525
| Variable | Description | Default value |
2626
|-----------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|
2727
| XML_XMLLINT_AUTOFORMAT | If set to `true`, it will reformat and reindent the output | `false` |
28-
| XML_XMLLINT_INDENT | The number of indentation spaces when `XML_XMLLINT_AUTOFORMAT` is `true` | ` ` |
28+
| XML_XMLLINT_INDENT | The number of indentation spaces when `XML_XMLLINT_AUTOFORMAT` is `true` | `` |
2929
| XML_XMLLINT_ARGUMENTS | User custom arguments to add in linter CLI call<br/>Ex: `-s --foo "bar"` | |
3030
| XML_XMLLINT_FILTER_REGEX_INCLUDE | Custom regex including filter<br/>Ex: `(src\|lib)` | Include every file |
3131
| XML_XMLLINT_FILTER_REGEX_EXCLUDE | Custom regex excluding filter<br/>Ex: `(test\|examples)` | Exclude no file |

megalinter/reporters/AzureCommentReporter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ def produce_report(self):
4040
"SYSTEM_PULLREQUEST_PULLREQUESTID", ""
4141
)
4242
if SYSTEM_PULLREQUEST_PULLREQUESTID == "":
43-
logging.warning(
43+
logging.info(
4444
"[Azure Comment Reporter] Missing value SYSTEM_PULLREQUEST_PULLREQUESTID\n"
4545
+ "You may need to configure a build validation policy to make it appear.\n"
4646
+ "See https://docs.microsoft.com/en-US/azure/devops/repos/git/"
4747
+ "branch-policies?view=azure-devops&tabs=browser#build-validation"
4848
)
49+
return
4950
SYSTEM_TEAMPROJECT = urllib.parse.quote(config.get("SYSTEM_TEAMPROJECT"))
5051
BUILD_REPOSITORY_ID = config.get("BUILD_REPOSITORY_ID")
5152
BUILD_BUILDID = config.get("BUILD_BUILDID", config.get("BUILD_BUILD_ID"))

0 commit comments

Comments
 (0)