Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: remove SUCCESS comments from PRs/MRs #526

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading