Skip to content
Merged
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
15 changes: 14 additions & 1 deletion .github/workflows/ci-client-cyclic-deps-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,40 @@ jobs:
with:
ref: refs/pull/${{ inputs.pr }}/merge

- name: Check for changes in app/client/src
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
app/client/src/**

- name: Count circular dependencies on PR branch
id: count-cyclic-deps-in-pr
if: steps.changed-files.outputs.any_changed == 'true'
run: |
npx dpdm ./src/* --circular --warning=false --tree=false > pr_circular_deps.txt
pr_count=$(cat pr_circular_deps.txt | wc -l)
echo "pr_count=$pr_count" >> $GITHUB_OUTPUT
cat pr_circular_deps.txt

- name: Checkout release branch
uses: actions/checkout@v4
if: steps.changed-files.outputs.any_changed == 'true'
with:
ref: release

- name: Count circular dependencies on release branch
id: coun-cyclic-deps-in-release
if: steps.changed-files.outputs.any_changed == 'true'
run: |
npx dpdm ./src/* --circular --warning=false --tree=false > release_circular_deps.txt
release_count=$(cat release_circular_deps.txt | wc -l)
echo "release_count=$release_count" >> $GITHUB_OUTPUT
cat release_circular_deps.txt

- name: Compare circular dependencies
id: compare-deps
if: steps.changed-files.outputs.any_changed == 'true'
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip

Codebase Verification

The comparison logic in the workflow file appears to have a typo in the variable name for the release count. Specifically, steps.coun-cyclic-deps-in-release.outputs.release_count should be steps.count-cyclic-deps-in-release.outputs.release_count.

  • Line with typo:

    release_count=${{ steps.coun-cyclic-deps-in-release.outputs.release_count }}
  • Corrected line:

    release_count=${{ steps.count-cyclic-deps-in-release.outputs.release_count }}

This typo would prevent the comparison logic from functioning correctly, as it would not be able to retrieve the correct count of circular dependencies from the release branch.

Analysis chain

Ensure accurate comparison logic.

The comparison logic is critical for determining if the PR has introduced more cyclic dependencies. It's important to ensure that this logic accurately reflects the differences.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the comparison logic between PR and release branch counts.

# Test: Simulate different scenarios to ensure the comparison logic correctly identifies changes in cyclic dependencies.
echo "Simulating with different counts..."
# Assuming a function or script to simulate this.

Length of output: 80



Script:

#!/bin/bash
# Extract the relevant steps in the workflow file that handle the comparison logic
workflow_file=".github/workflows/ci-client-cyclic-deps-check.yml"

# Display the lines around the comparison logic to understand the context
grep -A 5 -B 5 "steps.changed-files.outputs.any_changed == 'true'" "$workflow_file"

Length of output: 2086



Script:

#!/bin/bash
# Extract the comparison step to verify variable usage and output setting
workflow_file=".github/workflows/ci-client-cyclic-deps-check.yml"

# Display the lines around the comparison step to understand the context
grep -A 5 -B 5 "id: compare-deps" "$workflow_file"

Length of output: 672

run: |
release_count=${{ steps.coun-cyclic-deps-in-release.outputs.release_count }}
pr_count=${{ steps.count-cyclic-deps-in-pr.outputs.pr_count }}
Expand All @@ -60,7 +73,7 @@ jobs:

# Comment on the PR if cyclic dependencies are found
- name: Comment the result on PR
if: steps.compare-deps.outputs.has_more_cyclic_deps == 'true'
if: steps.compare-deps.outputs.has_more_cyclic_deps == 'true' && steps.changed-files.outputs.any_changed == 'true'
uses: actions/github-script@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
Expand Down