Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 945490f

Browse files
committed
use actions/checkout and CWD to run the commands to minimize raw shell script usage
1 parent 087f201 commit 945490f

File tree

2 files changed

+39
-10
lines changed

2 files changed

+39
-10
lines changed

.github/workflows/docs.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ on:
99
- main
1010
workflow_dispatch:
1111

12+
env:
13+
FSHARP_DIR: fsharp
14+
FSF_DIR: FSharp.Formatting
15+
16+
1217
jobs:
1318
build:
1419
strategy:
@@ -27,15 +32,25 @@ jobs:
2732
- name: Restore projects
2833
run: dotnet restore FSharp.Core\FSharp.Core.fsproj
2934
- name: Checkout fsharp main
30-
run: git clone https://github.com/dotnet/fsharp --depth 1 fsharp -b main
35+
uses: actions/checkout@v3
36+
with:
37+
repository: dotnet/fsharp
38+
path: ${{ env.FSHARP_DIR }}
39+
ref: main
3140
- name: Build fsharp main (turn of CI build status)
32-
run: cd fsharp && eng\CIBuild.cmd -noVisualStudio
41+
run: eng\CIBuild.cmd -noVisualStudio
42+
working-directory: ${{ env.FSHARP_DIR }}
3343
- name: Checkout FSharp.Formatting main
34-
run: git clone https://github.com/fsprojects/FSharp.Formatting --depth 1 FSharp.Formatting
44+
uses: actions/checkout@v3
45+
with:
46+
repository: fsprojects/FSharp.Formatting
47+
path: ${{ env.FSF_DIR }}
48+
ref: main
3549
- name: Build FSharp.Formatting main
36-
run: cd FSharp.Formatting && .\build -t Build
50+
run: .\build -t Build
51+
working-directory: ${{ env.FSF_DIR }}
3752
- name: Run fsdocs
38-
run: dotnet FSharp.Formatting\src\fsdocs-tool\bin\Release\net7.0\fsdocs.dll build --sourcefolder fsharp
53+
run: dotnet FSharp.Formatting\src\fsdocs-tool\bin\Release\net7.0\fsdocs.dll build --sourcefolder ${{ env.FSHARP_DIR }}
3954
- name: Deploy
4055
uses: peaceiris/actions-gh-pages@v3
4156
with:

.github/workflows/pr.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
branches:
66
- "**"
77

8+
env:
9+
FSHARP_DIR: fsharp
10+
FSF_DIR: FSharp.Formatting
11+
812
jobs:
913
build:
1014
strategy:
@@ -23,12 +27,22 @@ jobs:
2327
- name: Restore projects
2428
run: dotnet restore FSharp.Core\FSharp.Core.fsproj
2529
- name: Checkout fsharp main
26-
run: git clone https://github.com/dotnet/fsharp --depth 1 fsharp -b main
30+
uses: actions/checkout@v3
31+
with:
32+
repository: dotnet/fsharp
33+
path: ${{ env.FSHARP_DIR }}
34+
ref: main
2735
- name: Build fsharp main (turn of CI build status)
28-
run: cd fsharp && eng\CIBuild.cmd -noVisualStudio
36+
run: eng\CIBuild.cmd -noVisualStudio
37+
working-directory: ${{ env.FSHARP_DIR }}
2938
- name: Checkout FSharp.Formatting main
30-
run: git clone https://github.com/fsprojects/FSharp.Formatting --depth 1 FSharp.Formatting
39+
uses: actions/checkout@v3
40+
with:
41+
repository: fsprojects/FSharp.Formatting
42+
path: ${{ env.FSF_DIR }}
43+
ref: main
3144
- name: Build FSharp.Formatting main
32-
run: cd FSharp.Formatting && .\build -t Build
45+
run: .\build -t Build
46+
working-directory: ${{ env.FSF_DIR }}
3347
- name: Run fsdocs
34-
run: dotnet FSharp.Formatting\src\fsdocs-tool\bin\Release\net7.0\fsdocs.dll build --sourcefolder fsharp
48+
run: dotnet FSharp.Formatting\src\fsdocs-tool\bin\Release\net7.0\fsdocs.dll build --sourcefolder ${{ env.FSHARP_DIR }}

0 commit comments

Comments
 (0)