Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#3,857 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
90/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
git, github-actions, shell
Lĩnh vực
ci-cd

Hướng nghiên cứu

Logic bị lỗi nằm trong .github/workflows/test.yml, khoảng các dòng 73-77; trước tiên hãy đọc Main test job và failure run được tham chiếu, sau đó xác minh cách các sự kiện push và pull_request cung cấp các commit đang được so sánh. Cập nhật bước phát hiện tệp để cả hai loại sự kiện đều tạo ra các đường dẫn data/ như dự kiến, và xác nhận rằng Main test workflow không còn thoát do biến FILES rỗng đối với một pull request.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Shell
Star
421
Fork
822
Merge trung bình
12 giờ 29 phút
Pull request đã merge (30 ngày)
401

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AppImage/appimage.github.io

Tất cả issue của AppImage/appimage.github.io

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.