Skip to content

Commit 00efb21

Browse files
committed
git-artifacts: allow specifying repo/ref via workflow_dispatch
With this change, users can specify the branch and repository from which they want to build Git for Windows' artifacts, via the `ref` and `repository` inputs. This allows e.g. building `refs/heads/seen` of `git/git` (even if no `git-artifacts` workflow is configured in that repository), or `refs/pull/<number>/merge` for a given Pull Request. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent b811eb5 commit 00efb21

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/git-artifacts.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,19 @@ on:
77
inputs:
88
build_only:
99
description: 'Optionally restrict what artifacts to build'
10+
ref:
11+
description: 'Optionally override which branch to build'
12+
repository:
13+
description: 'Optionally override from where to fetch the specified ref'
1014

1115
env:
1216
GPG_OPTIONS: "--batch --yes --no-tty --list-options no-show-photos --verify-options no-show-photos --pinentry-mode loopback"
1317
HOME: "${{github.workspace}}\\home"
1418
MSYSTEM: MINGW64
1519
USERPROFILE: "${{github.workspace}}\\home"
1620
BUILD_ONLY: "${{github.event.inputs.build_only}}"
21+
REPOSITORY: "${{github.event.inputs.repository}}"
22+
REF: "${{github.event.inputs.ref}}"
1723

1824
jobs:
1925
bundle-artifacts:
@@ -70,9 +76,11 @@ jobs:
7076
printf '#!/bin/sh\n\nexec /mingw64/bin/git.exe "`$@"\n' >/usr/bin/git &&
7177
mkdir -p bundle-artifacts &&
7278
79+
{ test -n \"`$REPOSITORY\" || REPOSITORY='${{github.repository}}'; } &&
80+
{ test -n \"`$REF\" || REF='${{github.ref}}'; } &&
7381
git -c init.defaultBranch=main init --bare &&
7482
git remote add -f origin https://github.com/git-for-windows/git &&
75-
git fetch https://github.com/${{github.repository}} ${{github.ref}}:${{github.ref}} &&
83+
git fetch \"https://github.com/`$REPOSITORY\" \"`$REF:`$REF\" &&
7684
7785
tag_name=\"`$(git describe --match 'v[0-9]*' FETCH_HEAD)-`$(date +%Y%m%d%H%M%S)\" &&
7886
echo \"prerelease-`${tag_name#v}\" >bundle-artifacts/ver &&

0 commit comments

Comments
 (0)