Skip to content

fix: dependency-guard duplicate env + broken if condition#104

Merged
buger merged 1 commit into
mainfrom
fix/dependency-guard-env
Mar 31, 2026
Merged

fix: dependency-guard duplicate env + broken if condition#104
buger merged 1 commit into
mainfrom
fix/dependency-guard-env

Conversation

@buger

@buger buger commented Mar 31, 2026

Copy link
Copy Markdown
Member

Bug Fix

Two issues causing ALL workflows that use dependency-guard.yml to fail with 0 jobs:

  1. Duplicate env: key — BASE_REF and EXTRA_PATHS were in separate env: blocks on the same step. Invalid YAML.
  2. if: github.event_name == 'pull_request' on the job — when called via workflow_call, the event name is workflow_call, not pull_request. Job always skipped.

Fix

  • Merged both env vars into a single env: block
  • Removed the job-level if condition (the calling workflow already controls when it runs)

🤖 Generated with Claude Code

Two bugs:
1. Duplicate `env:` key on the same step (BASE_REF and EXTRA_PATHS
   in separate env blocks) — invalid YAML, GitHub Actions rejects
   at parse time with 0 jobs
2. `if: github.event_name == 'pull_request'` on the job — when called
   via workflow_call, event_name is 'workflow_call' not 'pull_request',
   so the job always skips

Fix: merge both env vars into one block, remove the job-level if
condition (the calling workflow controls when it runs).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@probelabs

probelabs Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

This PR fixes the dependency-guard.yml reusable workflow, which was failing for all consumers due to two distinct issues: an invalid YAML structure (duplicate env: keys) and a faulty conditional check (if: github.event_name == 'pull_request') that caused the job to be skipped when triggered via workflow_call.

The fix merges the environment variables into a single env: block and removes the incorrect job-level if condition, ensuring the workflow runs as intended for its consumers.

Files Changed Analysis

  • .github/workflows/dependency-guard.yml: Modified with 1 addition and 3 deletions to correct the workflow logic and syntax.

Architecture & Impact Assessment

  • Accomplishment: Restores the functionality of the dependency-guard.yml reusable workflow, unblocking CI/CD pipelines in other repositories that depend on it.
  • Technical Changes:
    1. Corrected a YAML syntax error by consolidating two env: blocks into one.
    2. Removed a job-level if condition that incorrectly prevented the workflow from running when called by other workflows.
  • Affected Components: This change directly affects the dependency-guard.yml workflow and, more importantly, any external CI/CD process that consumes it.

Workflow Execution Flow (Before vs. After)

graph TD
    subgraph before ["Before: Broken Execution"]
        A[Calling Workflow] -- workflow_call --> B(dependency-guard.yml);
        B --|"if: github.event_name == 'pull_request'<br/>(Evaluates to false)"|--> C{Job Skipped / Failed};
    end
    subgraph after ["After: Correct Execution"]
        D[Calling Workflow] -- workflow_call --> E(dependency-guard.yml);
        E --|"(No job-level 'if' condition)"|--> F{Job Runs Correctly};
    end
Loading

Scope Discovery & Context Expansion

This workflow is designed as a reusable component (on: workflow_call). A search for its usage within this repository found no internal callers, which indicates it is intended for consumption by other repositories. The failure was therefore impacting external consumers, making this a critical fix for dependent CI pipelines.

Metadata
  • Review Effort: 1 / 5
  • Primary Label: bug

Powered by Visor from Probelabs

Last updated: 2026-03-31T17:44:03.080Z | Triggered by: pr_opened | Commit: c7438af

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

@probelabs

probelabs Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

✅ Architecture Check Passed

No architecture issues found – changes LGTM.

✅ Performance Check Passed

No performance issues found – changes LGTM.

\n\n

✅ Architecture Check Passed

No architecture issues found – changes LGTM.

\n\n

✅ Performance Check Passed

No performance issues found – changes LGTM.

\n\n

✅ Quality Check Passed

No quality issues found – changes LGTM.


Powered by Visor from Probelabs

Last updated: 2026-03-31T17:43:28.829Z | Triggered by: pr_opened | Commit: c7438af

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

@buger
buger merged commit 2b35ab5 into main Mar 31, 2026
7 of 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.

1 participant