fix(ci): Skip OWASP dep check for doc-only changes#27305
Merged
yhwang merged 1 commit intoprestodb:masterfrom Mar 11, 2026
Merged
fix(ci): Skip OWASP dep check for doc-only changes#27305yhwang merged 1 commit intoprestodb:masterfrom
yhwang merged 1 commit intoprestodb:masterfrom
Conversation
Skip OWASP dep check for doc-only changes, excluding the change is on the presto-docs/pom.xml. We still want to run OWASP dep check if the pom.xml of the presto-docs project changes. Signed-off-by: Yihong Wang <yh.wang@ibm.com>
Contributor
Reviewer's GuideIntroduces a preparatory GitHub Actions job to detect non-docs changes in pull requests (while treating presto-docs/pom.xml as code), and conditionally runs the OWASP dependency-check workflow only when relevant code changes are present, thereby skipping the check for doc-only PRs. Flow diagram for skipping OWASP dependency-check on doc-only PRsflowchart TD
start["PR opened or updated"] --> paths_filter
paths_filter["Run paths-filter in job changes\nfilters: codechange\n- !presto-docs/**\n- presto-docs/pom.xml"] --> decision_codechange
decision_codechange{codechange == true?}
decision_codechange -->|yes| run_dependency_check
decision_codechange -->|no| skip_dependency_check
subgraph run_dependency_check["Job dependency-check (runs)"]
direction TB
checkout_pr["Checkout PR branch"] --> merge_base["Find merge base"] --> checkout_base["Checkout base branch"] --> setup_java["Set up Java"] --> get_date["Get date for cache key"] --> cache_restore["Restore OWASP cache"] --> scan_base["Run OWASP on base"] --> cache_save_partial["Save OWASP cache on miss"] --> scan_pr["Run OWASP on PR"] --> compare_cves["Compare CVEs and fail on regression"] --> cache_save_final["Save OWASP cache (final)"] --> upload_reports["Upload reports artifact"]
end
subgraph skip_dependency_check["Job dependency-check (skipped)"]
direction TB
note_skip["All steps gated by if: needs.changes.outputs.codechange == 'true'\nNo OWASP scanning for doc-only changes"]
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Consider moving the
if: needs.changes.outputs.codechange == 'true'condition to thedependency-checkjob level instead of repeating it on nearly every step, which reduces duplication and lowers the chance of missing the guard on new steps. - The new
changesjob relies onpull-requests: readandpaths-filter, but the workflow triggers (e.g.,push,workflow_dispatch) are not constrained here; verify that for non-PR eventsneeds.changes.outputs.codechangehas a sensible default so the OWASP check is not unintentionally skipped on those runs.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider moving the `if: needs.changes.outputs.codechange == 'true'` condition to the `dependency-check` job level instead of repeating it on nearly every step, which reduces duplication and lowers the chance of missing the guard on new steps.
- The new `changes` job relies on `pull-requests: read` and `paths-filter`, but the workflow triggers (e.g., `push`, `workflow_dispatch`) are not constrained here; verify that for non-PR events `needs.changes.outputs.codechange` has a sensible default so the OWASP check is not unintentionally skipped on those runs.
## Individual Comments
### Comment 1
<location path=".github/workflows/owasp-dependency-check.yml" line_range="33-34" />
<code_context>
+ - '!presto-docs/**'
+ - 'presto-docs/pom.xml'
+
dependency-check:
+ needs: changes
runs-on: ubuntu-latest
concurrency:
</code_context>
<issue_to_address>
**suggestion (performance):** Consider moving the `codechange` condition to the job level to avoid spinning up a runner when no relevant changes occurred.
Currently the `dependency-check` job always starts and each step is guarded with:
```yaml
if: needs.changes.outputs.codechange == 'true'
```
This still provisions a runner even when `codechange` is `false`. Instead, apply the condition at the job level:
```yaml
dependency-check:
needs: changes
if: needs.changes.outputs.codechange == 'true'
runs-on: ubuntu-latest
...
```
This avoids unnecessary runners and lets you drop the repeated `if` conditions from steps that don’t need their own logic.
Suggested implementation:
```
dependency-check:
needs: changes
if: needs.changes.outputs.codechange == 'true'
runs-on: ubuntu-latest
```
```
steps:
# Checkout PR branch first to get access to the composite action
- name: Checkout PR branch
uses: actions/checkout@v4
```
There are likely additional steps in the `dependency-check` job that also use `if: needs.changes.outputs.codechange == 'true'`. For consistency and to fully realize the optimization, remove that `if` condition from all steps that do not require their own, different conditional logic, since the job itself will only run when `codechange` is `true`.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
tdcmeehan
approved these changes
Mar 11, 2026
Member
Author
|
@tdcmeehan, thanks for the review, and reran the failed job. Let me merge the PR and check some new doc-only PRs to see if it works properly. |
This was referenced Mar 31, 2026
15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Skip OWASP dep check for doc-only changes; exclude the change in presto-docs/pom.xml. We still want to run OWASP dep check if the pom.xml of the presto-docs project changes.
Motivation and Context
Doc-only PRs shall skip the OWASP dep check, which reduces the time and resources for the CI jobs.
Impact
Doc-only PRs skip the OWASP check.
Test Plan
Use the same mechanism to skip the CI job, and I will also check some doc-only PRs after the change is merged.
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.
Summary by Sourcery
Skip the OWASP dependency check workflow for documentation-only pull requests while still running it when presto-docs/pom.xml changes.
CI: