-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
27 lines (27 loc) · 1.35 KB
/
action.yml
File metadata and controls
27 lines (27 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
name: "Checkout"
description: "Checkout limited git history to speed up CI"
inputs:
checkout-head-only:
description: "For PRs, checkout only the head SHA without merge commit"
required: false
default: 'true'
ref:
description: "The branch, tag or SHA to checkout. If not specified, uses default behavior."
required: false
default: ''
runs:
using: "composite"
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # https://github.com/actions/checkout/issues/1471 -> Fetch depth 0 required to actually get tags without using merge to head due to limited support of tag fetching
# See https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/
# and https://github.com/actions/checkout/pull/1396
filter: tree:0
# Due to https://github.com/actions/checkout/issues/1467,
# tags will get fetched automatically on tag events.
fetch-tags: ${{ github.event_name != 'release' }}
# Prevents pulling merged changes from main head when checkout-head-only is true
# If a custom ref is provided, use it; otherwise use the default PR head logic
ref: ${{ (inputs.ref != '' && inputs.ref) || ((github.event_name == 'pull_request' && inputs.checkout-head-only == 'true') && github.event.pull_request.head.sha || '') }}