Fix: Main test workflow fails with empty FILES variable in pull requests
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 90/100
調査の方向性
失敗しているロジックは .github/workflows/test.yml の73~77行目付近にあります。まず Main test job と参照されている failure run を読み、次に push イベントと pull_request イベントが比較対象のコミットをどのように公開するかを確認してください。ファイル検出ステップを更新し、両方のイベントタイプで意図した data/ パスが生成されるようにして、pull request で空の FILES 変数が原因となって Main test workflow が終了しなくなったことを確認してください。
索引モデルが 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
- 平均マージ
- 14時間 28分
- マージ済み PR(30日)
- 467
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AppImage/appimage.github.io のほかの issue
-
entry-unavailable
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
AppImage/appimage.github.io#10099 ·
メンテナーはふだん 1 日以内に返信
-
entry-unavailable
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
AppImage/appimage.github.io#10097 ·
メンテナーはふだん 1 日以内に返信
-
entry-unavailable
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
AppImage/appimage.github.io#10096 ·
メンテナーはふだん 1 日以内に返信
-
entry-unavailable
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
AppImage/appimage.github.io#10093 ·
メンテナーはふだん 1 日以内に返信
-
entry-unavailable
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
AppImage/appimage.github.io#10092 ·
メンテナーはふだん 1 日以内に返信
AppImage/appimage.github.io の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
gke-labs/kube-agents#3394 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
area:cli bug good first issue priority:medium
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信