-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
73 lines (64 loc) · 2.16 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: 'Refresh conda-lock'
description: 'Regenerate fully reproducible conda-lock.yml files for conda environments.'
author: 'GitHub'
branding: # https://haya14busa.github.io/github-action-brandings/
icon: 'lock'
color: 'green'
inputs:
file:
description: 'Path to the conda environment specification(s)'
required: true
default: 'environment.yml'
kind:
description: "Kind of lock file(s) to generate [should be one of 'lock', 'explicit', or 'env']"
required: false
default: 'lock'
mamba:
description: "Use the mamba solver [should be either 'true' or 'false']"
required: false
default: true
platform:
description: 'The platforms to generate the lockfile for'
required: false
default: 'linux-64'
runs:
using: "composite"
steps:
# Install conda-lock library with Micromamba
- uses: mamba-org/setup-micromamba@v1
with:
environment-name: conda-lock-env
create-args: >-
python=3.11
conda-lock
mamba
# Print debugging information
- name: Print debug info
run: |
conda-lock --version
mamba --version
echo Locking ${{ inputs.file }} file for ${{ inputs.platform }} platform.
shell: bash -l {0}
# Run conda-lock
- name: Run conda-lock
run: |
rm --force conda-lock.yml
conda-lock lock $MAMBA --file ${{ inputs.file }} --kind ${{ inputs.kind }} --platform ${{ inputs.platform }}
env:
MAMBA: "${{ inputs.mamba && '--mamba' || '--no-mamba' }}" # use --mamba if true, else --no-mamba
shell: bash -l {0}
# Print contents of lockfile
- name: Inspect lockfile
run: cat conda-lock.yml
shell: bash -l {0}
# Commit the change to the PR branch if any changes
- name: Commit condalock files to PR
run: |
if [[ $(git ls-files --modified --others) ]]; then
git config --global user.name 'actions-bot'
git config --global user.email '58130806+actions-bot@users.noreply.github.com'
git add --all
git commit --message "[condalock-command] autogenerated conda-lock files"
git push
fi
shell: bash -l {0}