Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭 适合新手
#3,857 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
90/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
git, github-actions, shell
领域
ci-cd

调研方向

失败的逻辑位于 .github/workflows/test.yml 的第 73-77 行附近;首先阅读 Main test job 和所引用的 failure run,然后验证 push 和 pull_request 事件如何提供正在比较的提交。更新文件检测步骤,使两种事件类型都产生预期的 data/ 路径,并确认 Main test workflow 不再因 pull request 中 FILES 变量为空而退出。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Shell
星标
421
派生
822
平均合并
12 小时 29 分钟
30 天内合并 PR
401

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AppImage/appimage.github.io 的其他 Issue

查看 AppImage/appimage.github.io 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。