diff --git a/.github/workflows/django-step-lint-check.yml b/.github/workflows/django-step-lint-check.yml index 498aeaca..3032d12f 100644 --- a/.github/workflows/django-step-lint-check.yml +++ b/.github/workflows/django-step-lint-check.yml @@ -24,6 +24,15 @@ on: required: false type: string default: "" + ENABLE_LFS: + required: false + type: boolean + default: false + # Workaround for https://github.com/actions/checkout/issues/1169 + LFS_REPO_PATH: + required: false + type: string + default: "" env: "${{secrets}}" @@ -48,8 +57,21 @@ jobs: image: redis steps: + - name: Install prerequisites + if: ${{ inputs.ENABLE_LFS == true }} + run: apt-get update && apt-get install -y git-lfs - name: Checkout code uses: actions/checkout@v3 + if: ${{ inputs.ENABLE_LFS == true }} + with: + lfs: 'true' + - uses: actions/checkout@v3 + if: ${{ inputs.ENABLE_LFS == false }} + - run: git config --global --add safe.directory /__w/mobygis-waterjade/mobygis-waterjade + if: ${{ inputs.ENABLE_LFS == true }} + - name: Checkout LFS objects + if: ${{ inputs.ENABLE_LFS == true }} + run: git lfs pull - name: Setup run: ${{ inputs.SETUP_COMMANDS }} - name: Install dependencies diff --git a/.github/workflows/django-step-tests.yml b/.github/workflows/django-step-tests.yml index 765fe08d..c39bc968 100644 --- a/.github/workflows/django-step-tests.yml +++ b/.github/workflows/django-step-tests.yml @@ -23,6 +23,16 @@ on: required: false type: string default: "" + ENABLE_LFS: + required: false + type: boolean + default: false + + # Workaround for https://github.com/actions/checkout/issues/1169 + LFS_REPO_PATH: + required: false + type: string + default: "" env: "${{secrets}}" @@ -47,7 +57,20 @@ jobs: image: redis steps: + - name: Install prerequisites + if: ${{ inputs.ENABLE_LFS == true }} + run: apt-get update && apt-get install -y git-lfs + - uses: actions/checkout@v3 + if: ${{ inputs.ENABLE_LFS == true }} + with: + lfs: 'true' - uses: actions/checkout@v3 + if: ${{ inputs.ENABLE_LFS == false }} + - run: git config --global --add safe.directory ${{ inputs.LFS_REPO_PATH }} + if: ${{ inputs.ENABLE_LFS == true }} + - name: Checkout LFS objects + if: ${{ inputs.ENABLE_LFS == true }} + run: git lfs pull - name: Setup run: ${{ inputs.SETUP_COMMANDS }} - name: Install dependencies diff --git a/.github/workflows/django-workflow-common.yml b/.github/workflows/django-workflow-common.yml index f591cd7b..b5316393 100644 --- a/.github/workflows/django-workflow-common.yml +++ b/.github/workflows/django-workflow-common.yml @@ -33,7 +33,15 @@ on: required: false type: string default: "" - + ENABLE_LFS: + required: false + type: boolean + default: false + # Workaround for https://github.com/actions/checkout/issues/1169 + LFS_REPO_PATH: + required: false + type: string + default: "" jobs: django-lint-check: uses: @@ -45,6 +53,8 @@ jobs: RUN: ${{inputs.RUN}} DJANGO_MIGRATIONS_CHECK_APPS: ${{inputs.DJANGO_MIGRATIONS_CHECK_APPS}} SETUP_COMMANDS: ${{inputs.SETUP_COMMANDS}} + ENABLE_LFS: ${{inputs.ENABLE_LFS}} + LFS_REPO_PATH: ${{inputs.LFS_REPO_PATH}} secrets: inherit django-tests: @@ -57,4 +67,6 @@ jobs: COVERAGE_ARTIFACT_NAME: ${{ inputs.COVERAGE_ARTIFACT_NAME }} RUN: ${{inputs.RUN}} SETUP_COMMANDS: ${{ inputs.SETUP_COMMANDS }} + ENABLE_LFS: ${{inputs.ENABLE_LFS}} + LFS_REPO_PATH: ${{inputs.LFS_REPO_PATH}} secrets: inherit diff --git a/README.md b/README.md index bf9263ac..9ab77501 100644 --- a/README.md +++ b/README.md @@ -1079,6 +1079,8 @@ In addition, it is possible to specify this optional input: - **RUN**: Whether to run all the inside workflows or not. This is useful when you want to skip checks since the code didn't change. By default, it is **true**. - **DJANGO_MIGRATIONS_CHECK_APPS**: The Django apps on which to run migration checks. - **SETUP_COMMANDS**: Allow to execute commands before the download of the dependencies. Useful to install packages required for Python dependencies. +- **ENABLE_LFS**: To enable Git LFS support on checkout +- **LFS_REPO_PATH**: Required when ENABLE_LFS is true. Workaround for https://github.com/actions/checkout/issues/1169. Set to "/__w/repo-name/repo-name" This is an example to show how data should be formatted.