forked from nschloe/action-cached-lfs-checkout
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
69 lines (64 loc) · 2.28 KB
/
action.yml
File metadata and controls
69 lines (64 loc) · 2.28 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: "Cached LFS checkout"
description: "Git checkout with LFS files from cache"
branding:
icon: "download"
color: "green"
inputs:
include:
description: "Explicitly include files for LFS"
required: false
default: "*"
exclude:
description: "Explicitly exclude files for LFS"
required: false
default: ""
fetch-depth:
description: "Number of commits to fetch. 0 indicates all history for all tags and branches"
required: false
default: 1
ref:
description: >
The branch, tag or SHA to checkout. When checking out the repository that
triggered a workflow, this defaults to the reference or SHA for that
event. Otherwise, uses the default branch.
required: false
default: ""
repository:
description: "Repository name with owner. For example, actions/checkout"
default: ${{ github.repository }}
token:
description: >
Personal access token (PAT) used to fetch the repository. The PAT is configured
with the local git config, which enables your scripts to run authenticated git
commands. The post-job step removes the PAT.
We recommend using a service account with the least permissions necessary.
Also when generating a new PAT, select the least scopes necessary.
[Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
required: false
default: ${{ github.token }}
persist-credentials:
description: >
'Whether to configure the token or SSH key with the local git config
required: false
default: true
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: ${{ inputs.fetch-depth }}
ref: ${{ inputs.ref }}
repository: ${{ inputs.repository }}
token: ${{ inputs.token }}
persist-credentials: ${{ inputs.persist-credentials }}
- name: Restore LFS cache
run: |
git config --global --add safe.directory $PWD
rm -rf .git/lfs
ln -s /mnt/lfs/lfs .git/lfs
# cp -r /mnt/lfs/lfs .git/lfs
git lfs pull --include "${{ inputs.include }}" --exclude "${{ inputs.exclude }}"
env:
GIT_TRACE: 1
shell: bash