Fix: Main test workflow fails with empty FILES variable in pull requests
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 90/100
Direzione di ricerca
La logica che presenta l’errore si trova in .github/workflows/test.yml, intorno alle righe 73-77; inizia leggendo il Main test job e la failure run indicata, quindi verifica come gli eventi push e pull_request espongono i commit confrontati. Aggiorna il passaggio di rilevamento dei file in modo che entrambi i tipi di evento producano i percorsi data/ previsti e conferma che il Main test workflow non termini più a causa di una variabile FILES vuota per una pull request.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Shell
- Stelle
- 395
- Fork
- 800
- Merge medio
- 10h 17m
- PR unite (30g)
- 340
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AppImage/appimage.github.io
-
entry-unavailable
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AppImage/appimage.github.io#9570 ·
I maintainer di solito rispondono entro 1 giorno
-
entry-unavailable
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
AppImage/appimage.github.io#9569 ·
I maintainer di solito rispondono entro 1 giorno
-
entry-unavailable
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
AppImage/appimage.github.io#9568 ·
I maintainer di solito rispondono entro 1 giorno
-
entry-unavailable
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AppImage/appimage.github.io#9567 ·
I maintainer di solito rispondono entro 1 giorno
-
entry-unavailable
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
AppImage/appimage.github.io#9566 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di AppImage/appimage.github.io
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
pnpm/pnpm#16635 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area/tests theme/ci-dx
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
FluidNumerics/fluid-walk-blocker#172 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
quickemu-project/quickemu#1960 ·
-
bug customer-reported
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
MagnaCapax/PMSS#1011 ·
I maintainer di solito rispondono entro 5 giorni