Skip to content

Commit 9fe326b

Browse files
committed
tag-git: make snapshot builds more convenient
The new default value for the `rev` input is now `main`, which -- in conjunction with `snapshot` being `true` by default -- will simply use the tip commit of git-for-windows/git's default branch. This is the most common scenario when building snapshots, that's why this is the new default. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 43c9344 commit 9fe326b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

.github/workflows/tag-git.yml

+13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
rev:
88
description: 'The commit to tag'
99
required: true
10+
default: main
1011
owner:
1112
description: 'Optionally override from where to fetch the specified rev'
1213
required: true
@@ -35,6 +36,18 @@ jobs:
3536
outputs:
3637
tag-name: ${{ steps.generate.outputs.tag-name }}
3738
steps:
39+
- name: 'Determine tip commit'
40+
if: env.REV == 'main'
41+
uses: actions/github-script@v7
42+
with:
43+
script: |
44+
if (process.env.SNAPSHOT === '') throw new Error(`Non-snapshot build on the 'main' branch is not supported.`)
45+
const { data: ref } = await github.rest.git.getRef({
46+
owner: process.env.OWNER,
47+
repo: 'git',
48+
ref: 'heads/main',
49+
})
50+
core.exportVariable('REV', ref.object.sha)
3851
- uses: actions/checkout@v4
3952
- name: Mirror Check Run to ${{ env.OWNER }}/${{ env.REPO }}
4053
if: env.CREATE_CHECK_RUN != 'false'

0 commit comments

Comments
 (0)