Skip to content

Commit f76696f

Browse files
committed
open-pr: avoid using the setup-git-for-windows-sdk Action
We actually need something different than the `minimal` SDK (which is used in git/git's CI builds to build Git and run its test suite): we need `updpkgsums` and friends. So far, we abused the Action to initialize the minimal SDK and then called `curl` plenty a time to download the remaining files. It would appear that that downloading part ran afoul of rate limits at least in one instance. Let's just use a partial clone to begin with. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent baa5ab4 commit f76696f

File tree

1 file changed

+37
-32
lines changed

1 file changed

+37
-32
lines changed

.github/workflows/open-pr.yml

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -74,40 +74,45 @@ jobs:
7474
7575
core.setSecret(accessToken)
7676
core.setOutput('token', accessToken)
77-
- name: set up partial Git for Windows SDK
78-
uses: git-for-windows/setup-git-for-windows-sdk@v1
79-
with:
80-
flavor: minimal
81-
- name: download files necessary for `updpkgsums` to work
77+
- name: initialize bare SDK clone
78+
shell: bash
79+
run: |
80+
git clone --bare --depth=1 --single-branch --branch=main --filter=blob:none \
81+
https://github.com/git-for-windows/git-sdk-64 .tmp
82+
- name: check out git-sdk-64 subset
8283
shell: bash
84+
env:
85+
GIT_CONFIG_PARAMETERS: "'checkout.workers=56'"
8386
run: |
84-
for p in \
85-
/etc/makepkg.conf \
86-
/usr/bin/gettext.exe \
87-
/usr/bin/makepkg \
88-
/usr/bin/nproc.exe \
89-
/usr/bin/pacman.exe \
90-
/usr/bin/sha256sum.exe \
91-
/usr/bin/updpkgsums \
92-
/mingw64/bin/curl.exe
93-
do
94-
curl -sLo $p https://github.com/git-for-windows/git-sdk-64/raw/HEAD$p || exit 1
95-
done &&
96-
for p in /usr/share/makepkg
97-
do
98-
b=${p##*/} &&
99-
d=${p%/$b} &&
100-
if test "z$b" = "z$d"
101-
then
102-
d=
103-
fi &&
104-
tree=$(curl -s https://api.github.com/repos/git-for-windows/git-sdk-64/git/trees/main:${d#/} |
105-
jq -r '.tree[] | select(.path | test("^'$b'$")) | .sha') &&
106-
mkdir -p $p &&
107-
curl -sL https://github.com/git-for-windows/git-sdk-64/tarball/$tree |
108-
tar --strip-components=1 -C $p -xzvf - || exit 1
109-
done &&
110-
printf '#!/bin/sh\n\nexec /mingw64/bin/curl.exe "$@"' >/usr/bin/curl
87+
git -C .tmp config extensions.worktreeConfig true &&
88+
git -C .tmp worktree add --no-checkout --detach "$PWD/.sdk" &&
89+
cd .sdk &&
90+
git config --worktree core.sparseCheckout true &&
91+
git config --worktree core.bare false &&
92+
sparse="$(git rev-parse --git-path info/sparse-checkout)" &&
93+
mkdir -p "${sparse%/*}" &&
94+
git show HEAD:.sparse/minimal-sdk >"$sparse" &&
95+
cat >>"$sparse" <<-EOF &&
96+
/etc/makepkg.conf
97+
/usr/bin/gettext.exe
98+
/usr/bin/makepkg
99+
/usr/bin/nproc.exe
100+
/usr/bin/pacman.exe
101+
/usr/bin/sha256sum.exe
102+
/usr/bin/updpkgsums
103+
/usr/share/makepkg/
104+
/mingw64/bin/curl.exe
105+
EOF
106+
git checkout -- &&
107+
108+
# makepkg/updpkgsums expects `curl` to be present in `/usr/bin/`
109+
printf '#!/bin/sh\n\nexec /mingw64/bin/curl.exe "$@"' >usr/bin/curl &&
110+
111+
# add the SDK directories to the `PATH`
112+
cygpath -aw "usr/bin/core_perl" >>$GITHUB_PATH &&
113+
cygpath -aw "usr/bin" >>$GITHUB_PATH &&
114+
cygpath -aw "mingw64/bin" >>$GITHUB_PATH &&
115+
echo "MSYSTEM=MINGW64" >>$GITHUB_ENV
111116
- name: Clone ${{ env.REPO }}
112117
shell: bash
113118
run: |

0 commit comments

Comments
 (0)