Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions workflow-templates/sync_app_panel.properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "Sync App Panel",
"description": "Auto-generate CodeOcean app-panel.json from a library's BaseSettings or argparse class using auto-app-panel",
"iconName": "mouse_robot",
"categories": [
"Python", "CodeOcean", "CI"
],
"filePatterns": [
".codeocean/app-panel.json"
]
}
64 changes: 64 additions & 0 deletions workflow-templates/sync_app_panel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Sync App Panel

on:
push:
branches:
- $default-branch
workflow_dispatch:

jobs:
sync-app-panel:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout capsule repo
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install library from environment.json
run: |
pip install auto-app-panel
pip install $(python -c "
import json
env = json.load(open('.codeocean/environment.json'))
for pkg in env['installers']['pip']['packages']:
print(f\"{pkg['name']}=={pkg['version']}\")
")

# Configure: set SOURCE to the module containing your BaseSettings/argparse class
# EG: local file: "code/run_capsule.py"
# EG: installed package: "my_package/settings.py" (gets resolved from site-packages)
# --strategy [overwrite|preserve] - Merge strategy (default: preserve)
# overwrite: Updates parameter values from code, preserves existing descriptions
# preserve: Keeps all existing values, only adds new parameters
# --no-backup - Skip creating timestamped backup of existing file
# https://pypi.org/project/auto-app-panel/
- name: Run auto-app-panel
run: |
SOURCE="your_package/your_module.py"
if [ -f "$SOURCE" ]; then
TARGET="$SOURCE"
else
SITE=$(python -c "import sysconfig; print(sysconfig.get_path('purelib'))")
TARGET="$SITE/$SOURCE"
fi
auto-app-panel \
"$TARGET" \
.codeocean/app-panel.json \
--strategy preserve \
--no-backup

- name: Commit changes (if any)
run: |
git diff --quiet .codeocean/app-panel.json && exit 0
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .codeocean/app-panel.json
git commit -m "ci: sync app-panel.json [skip actions]"
git push