Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Fix: Main test workflow fails with empty FILES variable in pull requests

Aperta Adatta ai principianti
#3,857 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

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
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
git, github-actions, shell
Ambito
ci-cd

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

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di AppImage/appimage.github.io

Tutte le issue di AppImage/appimage.github.io

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.