Fix: Main test workflow fails with empty FILES variable in pull requests
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 90/100
Research direction
The failing logic is in .github/workflows/test.yml around lines 73-77; start by reading the Main test job and the referenced failure run, then verify how push and pull_request events expose the commits being compared. Update the file-detection step so both event types produce the intended data/ paths, and confirm the Main test workflow no longer exits on an empty FILES variable for a pull request.
Written by the indexing model from the issue text.
Description
Problem
The "Main test" job in the test workflow is failing with:
Variable FILES is empty.
This occurs because the git log command used to detect changed files doesn't work correctly for pull requests.
Root Cause
The current file detection logic (line 74 in .github/workflows/test.yml):
FILES=$(git log -1 -p data/ | grep +++ | cut -d '/' -f 2-| sed -e 's|dev/null||g')
For pull requests, git log -1 examines the merge commit created by GitHub, which doesn't contain the actual file changes from the PR. This results in an empty FILES variable, causing the job to exit with code 1.
Solution
Replace the file detection logic to handle both push and pull request events correctly:
# Find out which files in data/ have been changed in the last commit
if [ "${{ github.event_name }}" == "pull_request" ]; then
# For PRs, compare against the base branch
FILES=$(git diff --name-only origin/master...HEAD -- data/ | sed -e 's|^|data/|')
else
# For pushes, use the standard git log approach
FILES=$(git log -1 -p data/ | grep +++ | cut -d '/' -f 2- | sed -e 's|dev/null||g')
fi
echo "Last changed files from the FILES variable:"
echo "$FILES"
if [ -z "$FILES" ]; then
echo "Variable FILES is empty."
exit 1
fi
This approach:
- For PRs: Uses
git diff --name-only origin/master...HEAD -- data/to compare the PR branch against the base branch, correctly identifying changed files - For pushes: Maintains the existing logic
- Ensures files are properly formatted with the
data/prefix
Apply this change to lines 73-77 of .github/workflows/test.yml
Failure Reference
https://github.com/AppImage/appimage.github.io/actions/runs/31879003988/job/94998828969
- Dominant language
- Shell
- Stars
- 395
- Forks
- 800
- Avg merge
- 6h 21m
- Merged PRs (30d)
- 301
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AppImage/appimage.github.io
-
entry-unavailable
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AppImage/appimage.github.io#9570 ·
Maintainers usually reply within 1 day
-
entry-unavailable
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
AppImage/appimage.github.io#9569 ·
Maintainers usually reply within 1 day
-
entry-unavailable
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
AppImage/appimage.github.io#9568 ·
Maintainers usually reply within 1 day
-
entry-unavailable
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
AppImage/appimage.github.io#9567 ·
Maintainers usually reply within 1 day
-
entry-unavailable
Difficulty 1/5 Under an hour Newbie friendliness 85/100
AppImage/appimage.github.io#9566 ·
Maintainers usually reply within 1 day
All issues in AppImage/appimage.github.io
Similar issues
-
documentation
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
obra/superpowers#2445 ·
Maintainers usually reply within 5 days
-
package-update
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
oSoWoSo/vOid_Community_repOsitory#240 · 1 comment ·
Maintainers usually reply within 1 day
-
ai-inspected
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day