| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
name: Set Shell |
| 6 |
description: Setup nix or custom shell for workflows |
| 7 |
|
| 8 |
inputs: |
| 9 |
nix-shell: |
| 10 |
description: Run in the specified Nix environment if exists. If empty, custom shell will be used instead of nix. |
| 11 |
default: 'ci' |
| 12 |
nix-cache: |
| 13 |
description: Determine whether to enable nix cache |
| 14 |
default: 'false' |
| 15 |
nix-cache-prefix: |
| 16 |
description: Fixed prefix of ID of Github cache entries that should be removed. |
| 17 |
required: false |
| 18 |
nix-verbose: |
| 19 |
description: Determine wether to suppress nix log or not |
| 20 |
default: 'false' |
| 21 |
custom_shell: |
| 22 |
description: The shell to use. Only relevant if no nix-shell specified |
| 23 |
default: 'bash' |
| 24 |
script: |
| 25 |
description: The script to be run in the nix shell |
| 26 |
required: false |
| 27 |
gh_token: |
| 28 |
description: Github access token to use |
| 29 |
required: true |
| 30 |
|
| 31 |
runs: |
| 32 |
using: composite |
| 33 |
steps: |
| 34 |
- name: Setup nix |
| 35 |
uses: ./.github/actions/setup-nix |
| 36 |
if: ${{ inputs.nix-shell != '' }} |
| 37 |
with: |
| 38 |
devShell: ${{ inputs.nix-shell }} |
| 39 |
gh_token: ${{ inputs.gh_token }} |
| 40 |
verbose: ${{ inputs.nix-verbose }} |
| 41 |
cache: ${{ inputs.nix-cache }} |
| 42 |
script: ${{ inputs.script }} |
| 43 |
cache_prefix: ${{ inputs.nix-cache-prefix }} |
| 44 |
- name: Set custom shell |
| 45 |
shell: bash |
| 46 |
if: ${{ inputs.nix-shell == '' }} |
| 47 |
run: | |
| 48 |
echo SHELL="${{ inputs.custom_shell }}" >> $GITHUB_ENV |
| 49 |
|
| 50 |
if [[ "${{ inputs.script }}" != '' ]]; then |
| 51 |
eval ${{ inputs.script }} |
| 52 |
fi |