Skip to content

Commit 2cb4335

Browse files
bump actions/checkout to v4 (#85)
* bump actions/checkout to v4 * add optional configs for checkout
1 parent 036411e commit 2cb4335

File tree

10 files changed

+200
-5
lines changed

10 files changed

+200
-5
lines changed

defaults/actions/Checkout.dhall

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{ repository = None Text
2+
, ref = None Text
3+
, token = None Text
4+
, ssh-key = None Text
5+
, ssh-known-hosts = None Text
6+
, ssh-strict = None Bool
7+
, ssh-user = None Text
8+
, persist-credentials = None Bool
9+
, path = None Text
10+
, clean = None Bool
11+
, filter = None Text
12+
, sparse-checkout = None Text
13+
, sparse-checkout-cone-mode = None Bool
14+
, fetch-depth = None Natural
15+
, fetch-tags = None Bool
16+
, show-progress = None Bool
17+
, lfs = None Bool
18+
, submodules = None Text
19+
, set-safe-directory = None Bool
20+
, github-server-url = None Text
21+
}

examples/checkout-complex.dhall

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
let GithubActions =
2+
https://regadas.dev/github-actions-dhall/package.dhall
3+
sha256:dfb18adac8746b64040c5387d51769177ce08a2d2a496da2446eb244f34cc21e
4+
5+
let checkoutMain =
6+
GithubActions.steps.actions/checkout
7+
GithubActions.actions/checkout::{
8+
, ref = Some "main"
9+
, fetch-depth = Some 0
10+
}
11+
12+
let checkoutPrivateRepo =
13+
GithubActions.steps.actions/checkout
14+
GithubActions.actions/checkout::{
15+
repository = Some "myorg/private-repo"
16+
, path = Some "./private-repo"
17+
, token = Some "\${{ secrets.PAT_TOKEN }}"
18+
, sparse-checkout = Some
19+
''
20+
src/
21+
docs/
22+
tests/
23+
''
24+
, sparse-checkout-cone-mode = Some True
25+
}
26+
27+
let checkoutWithSubmodules =
28+
GithubActions.steps.actions/checkout
29+
GithubActions.actions/checkout::{ submodules = Some "recursive", fetch-depth = Some 1, lfs = Some True }
30+
31+
in GithubActions.Workflow::{
32+
, name = "Complex Checkout Example"
33+
, on = GithubActions.On::{
34+
, push = Some GithubActions.Push::{
35+
, branches = Some [ "main", "develop" ]
36+
, paths-ignore = Some [ "docs/**" ]
37+
}
38+
}
39+
, jobs = toMap
40+
{ checkout-examples = GithubActions.Job::{
41+
, name = Some "Checkout Examples"
42+
, runs-on = GithubActions.types.RunsOn.ubuntu-latest
43+
, steps =
44+
[ checkoutMain
45+
, checkoutPrivateRepo
46+
, checkoutWithSubmodules
47+
]
48+
}
49+
}
50+
}

examples/out/checkout-complex.yaml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
jobs:
2+
"checkout-examples":
3+
name: Checkout Examples
4+
"runs-on": "ubuntu-latest"
5+
steps:
6+
- uses: "actions/checkout@v4"
7+
with:
8+
"fetch-depth": '0'
9+
ref: main
10+
- uses: "actions/checkout@v4"
11+
with:
12+
path: "./private-repo"
13+
repository: "myorg/private-repo"
14+
"sparse-checkout": |
15+
src/
16+
docs/
17+
tests/
18+
"sparse-checkout-cone-mode": 'true'
19+
token: "${{ secrets.PAT_TOKEN }}"
20+
- uses: "actions/checkout@v4"
21+
with:
22+
"fetch-depth": '1'
23+
lfs: 'true'
24+
submodules: recursive
25+
name: Complex Checkout Example
26+
'on':
27+
push:
28+
branches:
29+
- main
30+
- develop
31+
"paths-ignore":
32+
- "docs/**"

package.dhall

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
./schemas.dhall
2-
sha256:a83606c62b5bcb1d807446d713a6cb458e5fd3d1f3517cdd212228cb2971ee18
2+
sha256:20cd8ee44018603eb18f170fe3caac5b6efd8428f6e1c7d7452ed37f74af4dde
33
/\ { steps =
44
./steps.dhall
5-
sha256:ba64a8b88c72d500a8536958ca6be764a01b76aa52f02376a789bd93d0f797c0
5+
sha256:1660cee900cb215a9e23b2c03653756f3d5edc6ac3c9842d38dd7d540092fdb8
66
}
77
/\ { types =
88
./types.dhall
9-
sha256:4a1d52641e870be02dd236dc745e46df472d4dbf44bd93bc3e98e72eb10b315a
9+
sha256:ebba2dadbc053d7fa6227426c0eb61505e1be1a8d9cc0de47b9cbcae9600c4f0
1010
}

schemas.dhall

+3
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
, actions/HaskellSetup =
7171
./schemas/actions/HaskellSetup.dhall
7272
sha256:e6dbbacedf33965f5005dc2a22164d0a5edb3e09b2b4842104cec011c6d3c95d
73+
, actions/checkout =
74+
./schemas/actions/checkout.dhall
75+
sha256:d9c339bf138755db638c58f18d91dcd40a49f5905064af111b1b56d8eec57c5a
7376
, Concurrency =
7477
./schemas/Concurrency.dhall
7578
sha256:2ed562a8c402ad394223c57857e52915ab16b94775dfc0f4d277f227b6c6d450

schemas/actions/Checkout.dhall

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{ Type = ../../types/actions/Checkout.dhall
2+
, default = ../../defaults/actions/Checkout.dhall
3+
}

steps.dhall

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
sha256:3606d47244c51259f4d1b4761cf55a38fca1f72de1bc06db55be0c38068e3f86
77
, actions/checkout =
88
./steps/actions/checkout.dhall
9-
sha256:8a22d29eea007b2df0c3467dc732b835e46f3daccefba38312d4b4446c50b006
9+
sha256:a65f084b2844dd128664a7705f98dac51670d1c869700f4eb6c8ee11d0b0d9a7
1010
, actions/cache =
1111
./steps/actions/cache.dhall
1212
sha256:b6d6702a9faa91b3b64f9ac7e84b1f8706a460dd02fcf2e47cbbedb9053e6e96

steps/actions/checkout.dhall

+63-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,65 @@
1+
let List/concatMap =
2+
https://prelude.dhall-lang.org/v17.1.0/List/concatMap.dhall
3+
sha256:3b2167061d11fda1e4f6de0522cbe83e0d5ac4ef5ddf6bb0b2064470c5d3fb64
4+
5+
let Map =
6+
https://prelude.dhall-lang.org/v17.1.0/Map/package.dhall
7+
sha256:598e9c76103b2686fbbda6cc30078f9e60dd846d9eaf155d0149cf0ae06c21c5
8+
9+
let Optional/map =
10+
https://prelude.dhall-lang.org/v17.1.0/Optional/map.dhall
11+
sha256:501534192d988218d43261c299cc1d1e0b13d25df388937add784778ab0054fa
12+
113
let Step = ../../schemas/Step.dhall
214

3-
in Step::{ uses = Some "actions/checkout@v2" }
15+
let Checkout = ../../schemas/actions/Checkout.dhall
16+
17+
let stringBool =
18+
Optional/map Bool Text (λ(b : Bool) if b then "true" else "false")
19+
20+
let stringNatural =
21+
Optional/map Natural Text (λ(n : Natural) Natural/show n)
22+
23+
let checkout
24+
: Checkout.Type Step.Type
25+
= λ(args : Checkout.Type)
26+
Step::{
27+
, uses = Some "actions/checkout@v4"
28+
, `with` = Some
29+
( List/concatMap
30+
(Map.Entry Text (Optional Text))
31+
(Map.Entry Text Text)
32+
( λ(e : Map.Entry Text (Optional Text))
33+
merge
34+
{ None = [] : Map.Type Text Text
35+
, Some = λ(v : Text) [ Map.keyText e.mapKey v ]
36+
}
37+
e.mapValue
38+
)
39+
( toMap
40+
{ repository = args.repository
41+
, ref = args.ref
42+
, token = args.token
43+
, ssh-key = args.ssh-key
44+
, ssh-known-hosts = args.ssh-known-hosts
45+
, ssh-strict = stringBool args.ssh-strict
46+
, ssh-user = args.ssh-user
47+
, persist-credentials = stringBool args.persist-credentials
48+
, path = args.path
49+
, clean = stringBool args.clean
50+
, filter = args.filter
51+
, sparse-checkout = args.sparse-checkout
52+
, sparse-checkout-cone-mode = stringBool args.sparse-checkout-cone-mode
53+
, fetch-depth = stringNatural args.fetch-depth
54+
, fetch-tags = stringBool args.fetch-tags
55+
, show-progress = stringBool args.show-progress
56+
, lfs = stringBool args.lfs
57+
, submodules = args.submodules
58+
, set-safe-directory = stringBool args.set-safe-directory
59+
, github-server-url = args.github-server-url
60+
}
61+
)
62+
)
63+
}
64+
65+
in checkout

types.dhall

+3
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@
9494
, actions/HaskellSetup =
9595
./types/actions/HaskellSetup.dhall
9696
sha256:3cfef5c383d40623d0766715715c881583623bf6e11a0ad0b9946d8eaeffa6c5
97+
, actions/checkout =
98+
./types/actions/checkout.dhall
99+
sha256:bb5e351b16c5f15bdd76f111fc2ae43e1190e66b8805c429a05c2d41f661f30d
97100
, MergeGroup =
98101
./types/events/MergeGroup.dhall
99102
sha256:6932501dad0293756c78e48f64ae6b5549d373f7a178c26e300b69341de81fd6

types/actions/Checkout.dhall

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{ repository : Optional Text
2+
, ref : Optional Text
3+
, token : Optional Text
4+
, ssh-key : Optional Text
5+
, ssh-known-hosts : Optional Text
6+
, ssh-strict : Optional Bool
7+
, ssh-user : Optional Text
8+
, persist-credentials : Optional Bool
9+
, path : Optional Text
10+
, clean : Optional Bool
11+
, filter : Optional Text
12+
, sparse-checkout : Optional Text
13+
, sparse-checkout-cone-mode : Optional Bool
14+
, fetch-depth : Optional Natural
15+
, fetch-tags : Optional Bool
16+
, show-progress : Optional Bool
17+
, lfs : Optional Bool
18+
, submodules : Optional Text
19+
, set-safe-directory : Optional Bool
20+
, github-server-url : Optional Text
21+
}

0 commit comments

Comments
 (0)