Skip to content

Conversation

@KoblerS
Copy link
Collaborator

@KoblerS KoblerS commented Jan 13, 2026

Fixed Workflow Condition to Handle Skipped Approval

Bug Fix

🐛 Bug Fix: Updated GitHub Actions workflow conditions to ensure dependent jobs run correctly when the approval step is skipped for internal pull requests.

Changes

  • .github/workflows/ci.yml: Added conditional logic to all jobs that depend on requires-approval to execute when the approval is either successful or skipped. This ensures that internal pull requests from the cap-java organization bypass the approval requirement while external pull requests still require approval before running CI jobs.

The following jobs now include the condition if: always() && (needs.requires-approval.result == 'success' || needs.requires-approval.result == 'skipped'):

  • build
  • integration-tests
  • sonarqube-scan
  • scan
  • deploy-snapshot

This change ensures the CI pipeline functions correctly for both internal and external contributors without blocking internal PRs on unnecessary approval steps.

  • 🔄 Regenerate and Update Summary

@KoblerS KoblerS requested a review from Schmarvinius January 13, 2026 12:17
@KoblerS KoblerS self-assigned this Jan 13, 2026
Copy link
Contributor

@hyperspace-insights hyperspace-insights bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

I've identified a critical logic error in this pull request. While the PR correctly adds the conditional check to the build job (which directly depends on requires-approval), the same condition was incorrectly applied to all downstream jobs that depend on build, not requires-approval.

The jobs integration-tests, sonarqube-scan, scan, and deploy-snapshot all declare needs: build in their configurations, meaning they should check needs.build.result, not needs.requires-approval.result. With the current implementation, these jobs will execute even if the build fails, as long as the approval step succeeded or was skipped. This defeats the purpose of the dependency chain and could lead to running tests, scans, and deployments against failed builds.

Please update the conditional checks for these four jobs to reference the correct dependency.

PR Bot Information

Version: 1.17.5

  • Event Trigger: pull_request.opened
  • Correlation ID: c9e03af0-f079-11f0-90c5-9c913e038575
  • LLM: anthropic--claude-4.5-sonnet


integration-tests:
name: Integration Tests (Java ${{ matrix.java-version }})
if: always() && (needs.requires-approval.result == 'success' || needs.requires-approval.result == 'skipped')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic Error: Incorrect dependency check for integration-tests job

The integration-tests job depends on build (line 66), not requires-approval. It should check needs.build.result instead of needs.requires-approval.result. With the current condition, this job will run even if the build job fails, as long as approval succeeded/skipped.

Suggested change
if: always() && (needs.requires-approval.result == 'success' || needs.requires-approval.result == 'skipped')
if: always() && (needs.build.result == 'success' || needs.build.result == 'skipped')

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful


sonarqube-scan:
name: SonarQube Scan
if: always() && (needs.requires-approval.result == 'success' || needs.requires-approval.result == 'skipped')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic Error: Incorrect dependency check for sonarqube-scan job

The sonarqube-scan job depends on build (line 83), not requires-approval. It should check needs.build.result instead of needs.requires-approval.result. With the current condition, this job will run even if the build job fails, as long as approval succeeded/skipped.

Suggested change
if: always() && (needs.requires-approval.result == 'success' || needs.requires-approval.result == 'skipped')
if: always() && (needs.build.result == 'success' || needs.build.result == 'skipped')

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful


scan:
name: Blackduck Scan
if: always() && (needs.requires-approval.result == 'success' || needs.requires-approval.result == 'skipped')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic Error: Incorrect dependency check for scan job

The scan job depends on build (line 99), not requires-approval. It should check needs.build.result instead of needs.requires-approval.result. With the current condition, this job will run even if the build job fails, as long as approval succeeded/skipped.

Suggested change
if: always() && (needs.requires-approval.result == 'success' || needs.requires-approval.result == 'skipped')
if: always() && (needs.build.result == 'success' || needs.build.result == 'skipped')

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful


deploy-snapshot:
name: Deploy snapshot to Artifactory
if: always() && (needs.requires-approval.result == 'success' || needs.requires-approval.result == 'skipped')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logic Error: Incorrect dependency check for deploy-snapshot job

The deploy-snapshot job depends on build (line 116), not requires-approval. It should check needs.build.result instead of needs.requires-approval.result. With the current condition, this job will run even if the build job fails, as long as approval succeeded/skipped.

Suggested change
if: always() && (needs.requires-approval.result == 'success' || needs.requires-approval.result == 'skipped')
if: always() && (needs.build.result == 'success' || needs.build.result == 'skipped')

Double-check suggestion before committing. Edit this comment for amendments.


Please provide feedback on the review comment by checking the appropriate box:

  • 🌟 Awesome comment, a human might have missed that.
  • ✅ Helpful comment
  • 🤷 Neutral
  • ❌ This comment is not helpful

@Schmarvinius Schmarvinius merged commit 6add04c into main Jan 13, 2026
7 checks passed
@Schmarvinius Schmarvinius deleted the fix-workflow branch January 13, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants