Skip to content

Commit 672b540

Browse files
committed
add test for Git 2.15
1 parent c1649f7 commit 672b540

2 files changed

Lines changed: 74 additions & 6 deletions

File tree

.github/workflows/self-test.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,75 @@ jobs:
130130
run: |
131131
set -euo pipefail
132132
test "${{ steps.detached_tag.outcome }}" = "failure"
133+
134+
git-2-15-compat:
135+
runs-on: ubuntu-latest
136+
steps:
137+
- name: Check out action source
138+
uses: actions/checkout@v4
139+
with:
140+
path: action-src
141+
142+
- name: Install Git 2.15.0
143+
shell: bash
144+
run: |
145+
set -euo pipefail
146+
147+
sudo apt-get update
148+
sudo apt-get install -y \
149+
build-essential \
150+
gettext \
151+
libcurl4-openssl-dev \
152+
libexpat1-dev \
153+
libssl-dev \
154+
zlib1g-dev
155+
156+
curl -fsSL https://www.kernel.org/pub/software/scm/git/git-2.15.0.tar.xz -o git-2.15.0.tar.xz
157+
tar -xf git-2.15.0.tar.xz
158+
159+
pushd git-2.15.0 >/dev/null
160+
make prefix="${RUNNER_TEMP}/git-2.15.0" -j"$(nproc)" all
161+
make prefix="${RUNNER_TEMP}/git-2.15.0" install
162+
popd >/dev/null
163+
164+
echo "${RUNNER_TEMP}/git-2.15.0/bin" >> "$GITHUB_PATH"
165+
166+
- name: Verify Git version
167+
shell: bash
168+
run: |
169+
set -euo pipefail
170+
test "$(git --version | awk '{print $3}')" = "2.15.0"
171+
172+
- name: Prepare local fixture repository
173+
shell: bash
174+
run: |
175+
set -euo pipefail
176+
177+
git init --bare remote.git
178+
git init .
179+
git config user.email "ci@example.com"
180+
git config user.name "CI"
181+
git checkout -b main
182+
183+
echo "fixture report" > report.html
184+
git add report.html
185+
git commit -m "init fixture"
186+
187+
git remote add origin "remote.git"
188+
git push -u origin main
189+
190+
- name: Run action with explicit branch
191+
uses: ./action-src
192+
with:
193+
coverage: "75%"
194+
branch: main
195+
report: report.html
196+
197+
- name: Verify Git 2.15.0 run
198+
shell: bash
199+
run: |
200+
set -euo pipefail
201+
202+
files="$(git --git-dir=remote.git ls-tree --name-only -r coverage)"
203+
echo "$files" | grep -Fx "main/badge.svg"
204+
echo "$files" | grep -Fx "main/report.html"

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@ This action has no dependencies except for `git`, a `bash` shell and common *nix
1010
It supports Linux/macOS runners and Windows runners with Bash tooling (Git Bash/WSL-enabled images such as
1111
`windows-2025`).
1212

13-
Git features required by this action:
14-
- `git worktree add --detach` (documented in Git 2.5.6)
15-
- `git branch --format` (present in Git 2.13.7, absent in 2.12.5)
16-
- `git rev-parse --is-shallow-repository` (added in Git 2.15 release notes)
17-
18-
Therefore, use **Git 2.15.0 or newer**.
13+
Requires **Git 2.15.0 or newer**.
1914

2015
## Usage
2116

@@ -39,6 +34,7 @@ If you submitted a detailed HTML report of the coverage to the action, replace t
3934
- `report` (optional): Path to an HTML report file to publish as `report.html`.
4035
- `branch` (optional): Source branch override. Recommended for tag-triggered workflows where multiple branches may contain the same tag commit.
4136
Also recommended for very large or restricted repos to avoid scanning all remote branches during tag-triggered branch resolution.
37+
A Git-valid branch name may still be an invalid Windows path component (for example names containing `<`, `>`, `|`, or `"`), which can fail on Windows runners because this action writes files under `<branch>/...`.
4238

4339
## Examples
4440

0 commit comments

Comments
 (0)