Skip to content

Commit

Permalink
feat!: remove SUCCESS comments from PRs/MRs (#526)
Browse files Browse the repository at this point in the history
This change removes the `SUCCESS` comments from pull requests (PRs) and
merge requests (MRs). Other comment types are unchanged. This change is
necessary because the `SUCCESS` comments are considered by existing
customers to be too noisy and not useful since the related status check
will show as passing when the analysis is successful. Plus, the logs
contain the same information as was included in the `SUCCESS` comments.

Closes #78

BREAKING CHANGE: PRs/MRs will no longer have `SUCCESS` comments.
  • Loading branch information
maxrake authored Jan 14, 2025
1 parent a50711c commit 6cca5bd
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions docs/integrations/azure_pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
1 change: 1 addition & 0 deletions docs/integrations/bitbucket_pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/gitlab_ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
4 changes: 4 additions & 0 deletions src/phylum/ci/ci_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/phylum/ci/ci_bitbucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/phylum/ci/ci_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/phylum/ci/ci_gitlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6cca5bd

Please sign in to comment.