Skip to content

Commit 101f6b2

Browse files
author
Richard Top
committed
Fixed logic
1 parent 1f7592d commit 101f6b2

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

.github/workflows/test-software.eessi.io.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,27 @@ jobs:
4343
with:
4444
fetch-depth: 0 # Fetch all history for all branches and tags
4545

46-
- name: Get changed files (PR)
47-
run: |
48-
git fetch origin ${{ github.base_ref }}
49-
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
50-
echo "changed=$CHANGED_FILES" >> $GITHUB_OUTPUT
51-
5246
- name: Detect EESSI Versions
5347
- id: detect
5448
run: |
55-
# Detect changed files
56-
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
49+
# Get changed files from GitHub Actions context (only for pull requests)
50+
if [ "${{ github.event_name }}" == "pull_request" ]; then
51+
# Use jq to properly parse the changed_files array from GitHub event
52+
changed_files=$(jq -r '.pull_request.changed_files[]' "$GITHUB_EVENT_PATH" 2>/dev/null || echo "")
53+
echo "Changed files in PR:"
54+
echo "$changed_files"
55+
echo ""
56+
else
57+
changed_files=""
58+
fi
5759
5860
# Default to both EESSI versions if no specific match is found
5961
EESSI_VERSIONS='["2023.06", "2025.06"]'
6062
6163
# Check for specific versions
62-
if echo "$CHANGED_FILES" | grep -q "easystacks/software.eessi.io/2023.06"; then
64+
if echo "$changed_files" | grep -q "easystacks/software.eessi.io/2023.06"; then
6365
EESSI_VERSIONS='["2023.06"]'
64-
elif echo "$CHANGED_FILES" | grep -q "easystacks/software.eessi.io/2025.06"; then
66+
elif echo "$changed_files" | grep -q "easystacks/software.eessi.io/2025.06"; then
6567
EESSI_VERSIONS='["2025.06"]'
6668
fi
6769

0 commit comments

Comments
 (0)