Skip to content

Commit 12da16f

Browse files
authored
feat: make LFS checkout optional (#260)
Adds the option to disable LFS checkout either from services or as an input. Also, updates the registry for the docker image because docker tests were failing with permission issues Tested manually - tests here are failing for unrelated reasons.
1 parent 5008e79 commit 12da16f

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.github/workflows/docker_repo_tests.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
# This is a docker image that mimics the github runner image
1111
# https://github.com/catthehacker/docker_images/pkgs/container/ubuntu
12-
container: catthehacker/ubuntu:runner-20.04
12+
container: ghcr.io/catthehacker/ubuntu:runner-20.04
1313
strategy:
1414
fail-fast: false
1515
matrix:

action.yaml

+15-2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ inputs:
114114
required: false
115115
default: false
116116

117+
lfs-checkout:
118+
description: Option to checkout LFS files
119+
required: false
120+
default: true
121+
117122
runs:
118123
using: composite
119124
steps:
@@ -124,9 +129,15 @@ runs:
124129
GITHUB_TOKEN=${{ github.token }}
125130
EOF
126131
132+
# First arg is field to fetch, second arg is default value or empty
127133
payload() {
134+
if [ $# -lt 2 ]; then
135+
DEFAULT_VALUE=empty
136+
else
137+
DEFAULT_VALUE=\"$2\"
138+
fi
128139
if command -v jq >/dev/null; then
129-
jq -r ".inputs.payload | fromjson | .$1 // empty" ${TEST_GITHUB_EVENT_PATH:-${GITHUB_EVENT_PATH}}
140+
jq -r ".inputs.payload | fromjson | .$1 // ${DEFAULT_VALUE}" ${TEST_GITHUB_EVENT_PATH:-${GITHUB_EVENT_PATH}}
130141
else
131142
echo "::error::jq not installed on system!"
132143
exit 1
@@ -174,6 +185,7 @@ runs:
174185
INPUT_UPLOAD_SERIES=$(payload uploadSeries)
175186
INPUT_UPLOAD_ID=$(payload uploadId)
176187
INPUT_AUTOFIX_AND_PUSH=$(payload autofixAndPush)
188+
INPUT_LFS_CHECKOUT=$(payload lfsCheckout true)
177189
EOF
178190
179191
else
@@ -208,6 +220,7 @@ runs:
208220
INPUT_UPLOAD_SERIES=${{ inputs.upload-series }}
209221
INPUT_UPLOAD_ID=
210222
INPUT_AUTOFIX_AND_PUSH=
223+
INPUT_LFS_CHECKOUT=${{ inputs.lfs-checkout }}
211224
EOF
212225
213226
fi
@@ -216,7 +229,7 @@ runs:
216229
if: env.INPUT_TARGET_CHECKOUT
217230
uses: actions/checkout@v3
218231
with:
219-
lfs: true
232+
lfs: ${{ env.INPUT_LFS_CHECKOUT && inputs.lfs-checkout }}
220233
submodules: recursive
221234
repository: ${{ env.INPUT_TARGET_CHECKOUT }}
222235
ref: ${{ env.INPUT_TARGET_CHECKOUT_REF }}

0 commit comments

Comments
 (0)