actions-nix-init/action.yml

26 lines
1 KiB
YAML

name: 'Initialize CI Environment and Repository for Flake Builds'
description: |
Initialize a Nix Flakes CI environment (optionally with LFS).
inputs:
token:
description: 'OAUTH token to access repositories'
required: false
default: ${{ github.token }}
lfs:
description: Whether to enable lfs. Note that nix flake builds don't support LFS currently.
required: false
default: false
runs:
using: "composite"
steps:
- name: Checkout Repository
shell: bash
run: |
if [ "${{ inputs.lfs }}" == "true" ]; then git lfs install; fi
echo -e "machine ${GITHUB_SERVER_URL##https://}\nlogin oauth2\npassword ${{ inputs.token }}" > ~/.netrc
# Disable clone protection to pull LFS as well
GIT_CLONE_PROTECTION_ACTIVE=false git clone --branch $GITHUB_REF_NAME --recurse-submodules $GITHUB_SERVER_URL/$GITHUB_REPOSITORY .
git submodule update --init --recursive
- name: Prefetch git submodules in nix store
run: git submodule foreach --recursive 'nix flake prefetch'