Skip to content

improve checkout steps statement#126

Merged
bsten-tyk merged 1 commit into
mainfrom
improve-checkout-if-statement
May 11, 2026
Merged

improve checkout steps statement#126
bsten-tyk merged 1 commit into
mainfrom
improve-checkout-if-statement

Conversation

@olamilekan000

Copy link
Copy Markdown
Contributor
change improves checkout steps statement

@probelabs

probelabs Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

This PR refactors the conditional logic within the .github/workflows/branch-suggestion.yml workflow to make the code checkout process more robust and explicit.

The change replaces the dependency on github.event.pull_request.base.repo.name with the more direct and reliable github.repository context variable. This ensures the workflow can accurately determine if it's running within its own repository (TykTechnologies/github-actions) or being called from an external repository.

The conditions for the two checkout steps are now precise logical opposites, guaranteeing that one and only one step will execute, which correctly handles both pull request and non-pull-request events (like workflow_dispatch).

Files Changed Analysis

  • .github/workflows/branch-suggestion.yml: Modified with 2 additions and 2 deletions. The changes are confined to the if conditions of the two actions/checkout steps, improving the logic for determining which code to check out.

Architecture & Impact Assessment

  • What this PR accomplishes: It improves the reliability and readability of the checkout logic in the branch-suggestion reusable workflow, making its behavior more predictable across different trigger events and repositories.
  • Key technical changes introduced: The core change is the switch from inspecting the pull_request event context to using the github.repository context for identifying the repository. The logic for the second checkout step has been updated to be the correct logical negation of the first, ensuring it functions as a proper 'else' block.
  • Affected system components: This change directly affects the branch-suggestion.yml GitHub Actions workflow. It solidifies the initialization step of the workflow, which is critical for its correct execution both as a standalone action and as a reusable workflow.

Scope Discovery & Context Expansion

  • The change is localized to a single workflow file but is significant for its role as a reusable action. By making the context-detection logic more robust, this PR strengthens the architectural pattern of centralized, reusable workflows. It ensures the action can reliably distinguish between a "local" run (for its own CI) and a "remote" run (when called by another repository's pipeline), preventing checkout failures in non-PR scenarios.
Metadata
  • Review Effort: 1 / 5
  • Primary Label: chore

Powered by Visor from Probelabs

Last updated: 2026-05-11T15:04:15.100Z | Triggered by: pr_updated | Commit: 1e3e559

💡 TIP: You can chat with Visor using /visor ask <your question>

@probelabs

probelabs Bot commented May 11, 2026

Copy link
Copy Markdown
Contributor

✅ Security Check Passed

No security issues found – changes LGTM.

✅ Performance Check Passed

No performance issues found – changes LGTM.

✅ Quality Check Passed

No quality issues found – changes LGTM.


Powered by Visor from Probelabs

Last updated: 2026-05-11T15:04:00.869Z | Triggered by: pr_updated | Commit: 1e3e559

💡 TIP: You can chat with Visor using /visor ask <your question>

@olamilekan000
olamilekan000 force-pushed the improve-checkout-if-statement branch from b6fe1cd to 1e3e559 Compare May 11, 2026 15:02
@bsten-tyk
bsten-tyk merged commit c0d4c3d into main May 11, 2026
8 checks passed
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.

2 participants