Skip to content

ignore some more local files #75

ignore some more local files

ignore some more local files #75

name: Update locked envs
on:
push:
paths:
- envs/environment.yaml
schedule:
- cron: "0 8 1,16 * *" # Bi-weekly
workflow_dispatch:
env:
BASE_ENV: envs/environment.yaml
jobs:
update-locked-environment:
if: ${{ github.ref == 'refs/heads/main' }}
name: Update pinned envs
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v5
- name: Setup conda
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
activate-environment: ${{ github.event.repository.name }}
channel-priority: strict
environment-file: ${{ env.BASE_ENV }}
- name: Install conda-lock
run: |
conda install -c conda-forge conda-lock
- name: Generate lockfiles for all platforms
run: |
conda-lock -f ${{ env.BASE_ENV }} \
-p linux-64 -p osx-64 -p win-64 -p osx-arm64 \
-k env --filename-template "envs/{platform}.lock"
# Rename to .yaml extension
for file in envs/*.lock.yml; do
mv "$file" "${file%.yml}.yaml"
done
- name: Insert environment name in lock files
run: |
for file in envs/*.lock.yaml; do
if [ -f "$file" ]; then
echo "Processing $file"
if ! grep -q "name: pypsa-de" "$file"; then
# Insert name: pypsa-de before channels section
sed -i '7a name: pypsa-de' "$file"
else
echo "name: pypsa-de already exists in $file"
fi
fi
done
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: lockfiles
path: envs/*.lock.yaml
create-pull-request:
needs: update-locked-environment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Download all artifacts
uses: actions/download-artifact@v5
with:
name: lockfiles
path: envs/
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-locked-environment
title: "[github-actions.ci] Update locked envs"
body: |
Automatically generated PR to update locked environment files for Windows, macOS, and Linux.
These files were generated using conda-lock for improved dependency resolution and reproducibility.
**Note: Do not merge without manual test execution. Either update the branch to trigger tests, or use `workflow_dispatch` to run tests manually. Unlike standard PRs, tests will not run automatically.**
commit-message: "Update locked environment files for all platforms"