diff --git a/README.md b/README.md index 9f4661f..f64c29e 100644 --- a/README.md +++ b/README.md @@ -213,7 +213,7 @@ because they indicate a complete Phylum analysis was not possible, which necessi [option is available][script_options] to explicitly prevent these errors from setting an exit code. [script_options]: #phylum-ci-script-entry-point -[FAQ]: https://github.com/marketplace/actions/phylum-analyze-pr#why-does-phylum-report-a-failing-status-check-if-it-shows-a-successful-analysis-comment +[FAQ]: https://github.com/marketplace/actions/phylum-analyze-pr#why-does-phylum-report-a-failing-status-check-if-it-shows-successful-analysis ## License diff --git a/docs/integrations/azure_pipelines.md b/docs/integrations/azure_pipelines.md index efaecc2..013c3a2 100644 --- a/docs/integrations/azure_pipelines.md +++ b/docs/integrations/azure_pipelines.md @@ -20,6 +20,7 @@ skip comments is provided. The CI job will return an error (i.e., fail the build fail to meet the established policy unless audit mode is specified. There will be no comment if no dependencies were added or modified for a given PR. +There will be no comment when the results of the analysis are successful. If one or more dependencies are still processing (no results available), then the comment will make that clear and the CI pipeline job will only fail if dependencies that have _completed analysis results_ do not meet the active policy. diff --git a/docs/integrations/bitbucket_pipelines.md b/docs/integrations/bitbucket_pipelines.md index d99e216..8d0e972 100644 --- a/docs/integrations/bitbucket_pipelines.md +++ b/docs/integrations/bitbucket_pipelines.md @@ -37,6 +37,7 @@ comments is provided. The CI job will return an error (i.e., fail the build) if to meet the established policy unless audit mode is specified. There will be no comment if no dependencies were added or modified for a given PR. +There will be no comment when the results of the analysis are successful. If one or more dependencies are still processing (no results available), then the comment will make that clear and the CI job will only fail if dependencies that have _completed analysis results_ do not meet the active policy. diff --git a/docs/integrations/gitlab_ci.md b/docs/integrations/gitlab_ci.md index 61925d6..d1ad36d 100644 --- a/docs/integrations/gitlab_ci.md +++ b/docs/integrations/gitlab_ci.md @@ -16,6 +16,7 @@ comments is provided. The CI job will return an error (i.e., fail the build) if to meet the established policy unless audit mode is specified. There will be no note if no dependencies were added or modified for a given MR. +There will be no note when the results of the analysis are successful. If one or more dependencies are still processing (no results available), then the note will make that clear and the CI job will only fail if dependencies that have _completed analysis results_ do not meet the active policy. diff --git a/src/phylum/ci/ci_azure.py b/src/phylum/ci/ci_azure.py index 027b87c..657d102 100644 --- a/src/phylum/ci/ci_azure.py +++ b/src/phylum/ci/ci_azure.py @@ -30,6 +30,7 @@ from phylum.ci.ci_base import CIBase from phylum.ci.ci_github import get_most_recent_phylum_comment_github, post_github_comment +from phylum.ci.common import ReturnCode from phylum.ci.git import git_default_branch_name, git_remote from phylum.constants import PHYLUM_HEADER, PHYLUM_USER_AGENT, REQ_TIMEOUT from phylum.exceptions import pprint_subprocess_error @@ -331,6 +332,9 @@ def post_output(self) -> None: # Can't post the output to the PR when there is no PR return + if self.returncode == ReturnCode.SUCCESS: + return + if self.skip_comments: LOG.debug("Posting analysis output as comments on the pull request was disabled.") return diff --git a/src/phylum/ci/ci_bitbucket.py b/src/phylum/ci/ci_bitbucket.py index f88bca6..967059c 100644 --- a/src/phylum/ci/ci_bitbucket.py +++ b/src/phylum/ci/ci_bitbucket.py @@ -29,6 +29,7 @@ import requests from phylum.ci.ci_base import CIBase +from phylum.ci.common import ReturnCode from phylum.ci.git import git_default_branch_name, git_remote from phylum.constants import PHYLUM_HEADER, PHYLUM_USER_AGENT, REQ_TIMEOUT from phylum.exceptions import pprint_subprocess_error @@ -249,6 +250,9 @@ def post_output(self) -> None: # Can't post the output to the PR when there is no PR return + if self.returncode == ReturnCode.SUCCESS: + return + if self.skip_comments: LOG.debug("Posting analysis output as comments on the pull request was disabled.") return diff --git a/src/phylum/ci/ci_github.py b/src/phylum/ci/ci_github.py index e59d75f..dd25444 100644 --- a/src/phylum/ci/ci_github.py +++ b/src/phylum/ci/ci_github.py @@ -23,6 +23,7 @@ import requests from phylum.ci.ci_base import CIBase +from phylum.ci.common import ReturnCode from phylum.constants import PHYLUM_HEADER, REQ_TIMEOUT from phylum.exceptions import PhylumCalledProcessError from phylum.github import get_headers, github_request @@ -214,6 +215,9 @@ def post_output(self) -> None: """ super().post_output() + if self.returncode == ReturnCode.SUCCESS: + return + if self.skip_comments: LOG.debug("Posting analysis output as comments on the pull request was disabled.") return diff --git a/src/phylum/ci/ci_gitlab.py b/src/phylum/ci/ci_gitlab.py index 45258f2..59a565f 100644 --- a/src/phylum/ci/ci_gitlab.py +++ b/src/phylum/ci/ci_gitlab.py @@ -20,6 +20,7 @@ import requests from phylum.ci.ci_base import CIBase +from phylum.ci.common import ReturnCode from phylum.ci.git import git_branch_exists, git_default_branch_name, git_fetch, git_remote from phylum.constants import PHYLUM_HEADER, PHYLUM_USER_AGENT, REQ_TIMEOUT from phylum.exceptions import pprint_subprocess_error @@ -201,6 +202,9 @@ def post_output(self) -> None: # Can't post the output to the MR when there is no MR return + if self.returncode == ReturnCode.SUCCESS: + return + if self.skip_comments: LOG.debug("Posting analysis output as notes on the merge request was disabled.") return