Skip to content

Commit

Permalink
Fix failure of AzureCommentReporter when there is no pull request fou…
Browse files Browse the repository at this point in the history
…nd 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]>
  • Loading branch information
nvuillam and nvuillam authored Apr 2, 2023
1 parent fe568b3 commit 785a1eb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
- Linter enhancements & fixes

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

- Documentation

Expand Down
2 changes: 1 addition & 1 deletion docs/descriptors/xml_xmllint.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To apply file formatting you must set `XML_XMLLINT_CLI_LINT_MODE: file` and `XML
| Variable | Description | Default value |
|-----------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------|
| XML_XMLLINT_AUTOFORMAT | If set to `true`, it will reformat and reindent the output | `false` |
| XML_XMLLINT_INDENT | The number of indentation spaces when `XML_XMLLINT_AUTOFORMAT` is `true` | ` ` |
| XML_XMLLINT_INDENT | The number of indentation spaces when `XML_XMLLINT_AUTOFORMAT` is `true` | `` |
| XML_XMLLINT_ARGUMENTS | User custom arguments to add in linter CLI call<br/>Ex: `-s --foo "bar"` | |
| XML_XMLLINT_FILTER_REGEX_INCLUDE | Custom regex including filter<br/>Ex: `(src\|lib)` | Include every file |
| XML_XMLLINT_FILTER_REGEX_EXCLUDE | Custom regex excluding filter<br/>Ex: `(test\|examples)` | Exclude no file |
Expand Down
3 changes: 2 additions & 1 deletion megalinter/reporters/AzureCommentReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ def produce_report(self):
"SYSTEM_PULLREQUEST_PULLREQUESTID", ""
)
if SYSTEM_PULLREQUEST_PULLREQUESTID == "":
logging.warning(
logging.info(
"[Azure Comment Reporter] Missing value SYSTEM_PULLREQUEST_PULLREQUESTID\n"
+ "You may need to configure a build validation policy to make it appear.\n"
+ "See https://docs.microsoft.com/en-US/azure/devops/repos/git/"
+ "branch-policies?view=azure-devops&tabs=browser#build-validation"
)
return
SYSTEM_TEAMPROJECT = urllib.parse.quote(config.get("SYSTEM_TEAMPROJECT"))
BUILD_REPOSITORY_ID = config.get("BUILD_REPOSITORY_ID")
BUILD_BUILDID = config.get("BUILD_BUILDID", config.get("BUILD_BUILD_ID"))
Expand Down

0 comments on commit 785a1eb

Please sign in to comment.