diff --git a/CHANGELOG.md b/CHANGELOG.md index 26b6ef44822..ba56403ca88 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l - New linters - Fixes + - Activate CI servers reporters only if we find a related default env variable - Doc diff --git a/megalinter/reporters/AzureCommentReporter.py b/megalinter/reporters/AzureCommentReporter.py index 8142328f4b2..e9a0af77a21 100644 --- a/megalinter/reporters/AzureCommentReporter.py +++ b/megalinter/reporters/AzureCommentReporter.py @@ -26,7 +26,9 @@ class AzureCommentReporter(Reporter): scope = "mega-linter" def manage_activation(self): - if ( + if not config.exists(self.master.request_id, "SYSTEM_COLLECTIONURI"): + self.is_active = False + elif ( config.get(self.master.request_id, "AZURE_COMMENT_REPORTER", "true") != "true" ): diff --git a/megalinter/reporters/BitbucketCommentReporter.py b/megalinter/reporters/BitbucketCommentReporter.py index 3cee301e495..9a93c6003bd 100644 --- a/megalinter/reporters/BitbucketCommentReporter.py +++ b/megalinter/reporters/BitbucketCommentReporter.py @@ -18,7 +18,9 @@ class BitbucketCommentReporter(Reporter): BITBUCKET_API = "https://api.bitbucket.org/2.0" def manage_activation(self): - if ( + if not config.exists(self.master.request_id, "BITBUCKET_REPO_FULL_NAME"): + self.is_active = False + elif ( config.get(self.master.request_id, "BITBUCKET_COMMENT_REPORTER", "true") == "true" ): diff --git a/megalinter/reporters/GithubCommentReporter.py b/megalinter/reporters/GithubCommentReporter.py index fde46088013..09e58e2256b 100644 --- a/megalinter/reporters/GithubCommentReporter.py +++ b/megalinter/reporters/GithubCommentReporter.py @@ -22,7 +22,9 @@ class GithubCommentReporter(Reporter): issues_root = ML_REPO_URL + "/issues" def manage_activation(self): - if ( + if not config.exists(self.master.request_id, "GITHUB_REPOSITORY"): + self.is_active = False + elif ( config.get(self.master.request_id, "GITHUB_COMMENT_REPORTER", "true") != "true" ): diff --git a/megalinter/reporters/GitlabCommentReporter.py b/megalinter/reporters/GitlabCommentReporter.py index 8c851e94690..d9ac8c282b3 100644 --- a/megalinter/reporters/GitlabCommentReporter.py +++ b/megalinter/reporters/GitlabCommentReporter.py @@ -18,6 +18,8 @@ class GitlabCommentReporter(Reporter): gitlab_server_url = "https://gitlab.com" def manage_activation(self): + if not config.exists(self.master.request_id, "CI_JOB_TOKEN"): + self.is_active = False if ( config.get(self.master.request_id, "GITLAB_COMMENT_REPORTER", "true") != "true"