Skip to content
Open
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
17 changes: 16 additions & 1 deletion .github/workflows/headlamp-plugin-github-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,24 @@ jobs:

- name: Find changed Headlamp plugin directories
id: dirs
env:
BEFORE_SHA: ${{ github.event.before }}
run: |
# Determine the correct base ref depending on the event type.
# On push, github.event.before is the commit SHA before the push.
# On pull_request, origin/main is the correct base.
if [ "$GITHUB_EVENT_NAME" = "push" ]; then
BASE_REF="$BEFORE_SHA"
# Fallback for new branches where before SHA is all zeros
if [ "$BASE_REF" = "0000000000000000000000000000000000000000" ]; then
BASE_REF="HEAD~1"
fi
else
BASE_REF="origin/main"
fi

# Get all top-level directories that had changes
changed_dirs=$(git diff --name-only origin/main...HEAD | awk -F/ '{print $1}' | sort -u)
changed_dirs=$(git diff --name-only "$BASE_REF"...HEAD | awk -F/ '{print $1}' | sort -u)
echo "Changed directories: $changed_dirs"

# If .github/ changed, run all plugins
Expand Down