Skip to content

Commit a2da413

Browse files
committed
CI: use fetch-depth:0 for release job
We use the `git describe` command to prevent release-notes commits to create nuget prereleases for commits that have already been tagged as a "non-pre" release; see: fa788db However, this stopped working since someone upgraded the checkout action to v4: a2b2d94 What must be happening is that this new version of this action now uses a depth of 1 by default, to save bandwidth, and then the command `git describe` fails with this error: ``` fatal: No names found, cannot describe anything. ``` There's a good StackOverflow entry about this issue, and someone recommends `fetch-depth: 0` there to fix it: https://stackoverflow.com/questions/4916492/git-describe-fails-with-fatal-no-names-found-cannot-describe-anything#comment118391143_45993185
1 parent ee95fc3 commit a2da413

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

.github/workflows/build+test+deploy.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ jobs:
4343

4444
steps:
4545
- uses: actions/checkout@v4
46+
47+
with:
48+
# we need fetch-depth: 0 because we use the `git describe` command in build.fsx
49+
fetch-depth: 0
50+
4651
- name: Restore tools
4752
run: dotnet tool restore
4853
- name: Build

build.fsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ Target.create "Push" (fun _ ->
224224
| None ->
225225
failwith "GITHUB_SHA should have been populated"
226226
| Some commitHash ->
227+
// NOTE: for this to work, github workflow needs to have `fetch-depth: 0` in its checkout action
227228
let gitArgs = $"describe --exact-match --tags %s{commitHash}"
228229
let proc =
229230
CreateProcess.fromRawCommandLine "git" gitArgs

0 commit comments

Comments
 (0)