Compare commits
2 commits
2755cb9120
...
9f87b08578
Author | SHA1 | Date | |
---|---|---|---|
9f87b08578 | |||
f5bc4ffdef |
1 changed files with 19 additions and 4 deletions
23
action.yml
23
action.yml
|
@ -1,5 +1,14 @@
|
|||
name: 'Initialize CI Environment and Repository'
|
||||
description: 'Initialize a CI environment with nix (and also checkout the repository recursively with LFS)'
|
||||
inputs:
|
||||
token:
|
||||
description: 'OAUTH token to access repositories'
|
||||
required: false
|
||||
default: ${{ github.token }}
|
||||
lfs:
|
||||
description: 'Whether to enable lfs'
|
||||
required: false
|
||||
default: true
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
|
@ -10,11 +19,17 @@ runs:
|
|||
nix profile install nixpkgs#git-lfs nixpkgs#gnused
|
||||
mkdir -p ~/.config/nix && cp /etc/nix/nix.conf ~/.config/nix/
|
||||
|
||||
- name: Checkout Repository
|
||||
- name: Enable lfs
|
||||
if: inputs.lfs == true
|
||||
shell: "nix shell nixpkgs#git-lfs nixpkgs#gnused --command {0}"
|
||||
run: |
|
||||
git lfs install
|
||||
git config --global credential.helper store
|
||||
AUTH_URL=`echo -n "$GITHUB_SERVER_URL" | sed "s%https://%https://oauth2:$GITHUB_TOKEN@%"`
|
||||
|
||||
- name: Checkout Repository
|
||||
shell: "nix shell nixpkgs#git-lfs nixpkgs#gnused --command {0}"
|
||||
run: |
|
||||
GIT_SERVER=`echo -n "$GITHUB_SERVER_URL" | sed "s%https://%%"`
|
||||
echo -e "machine $GIT_SERVER\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 $AUTH_URL/$GITHUB_REPOSITORY .
|
||||
GIT_CLONE_PROTECTION_ACTIVE=false git clone --branch $GITHUB_REF_NAME --recurse-submodules $GITHUB_SERVER_URL/$GITHUB_REPOSITORY .
|
||||
git submodule update --init
|
||||
|
|
Loading…
Add table
Reference in a new issue