Skip to content

[MERGE-WITH-SDK-ROLL-RC6] Remote Storage: Tool build and version roll over #823

[MERGE-WITH-SDK-ROLL-RC6] Remote Storage: Tool build and version roll over

[MERGE-WITH-SDK-ROLL-RC6] Remote Storage: Tool build and version roll over #823

name: Automate pdm.lock
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, review_requested]
branches: [main]
paths:
- '**/pyproject.toml'
workflow_dispatch:
inputs:
directories:
description: 'Comma-separated list of directories to update'
required: false
default: '' # Run for all dirs specified in docker/scripts/pdm-lock-gen/pdm-lock.sh
jobs:
update_pdm_lock:
name: Update PDM lock in all directories
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install PDM
run: python -m pip install pdm==2.16.1
- name: Generate PDM lockfiles
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
chmod +x ./docker/scripts/pdm-lock-gen/pdm-lock.sh
# Get the input from the workflow or use the default value
dirs="${{ github.event.inputs.directories }}"
# Check if directories input is empty
if [[ -z "$dirs" ]]; then
# No directories input given, run the script without arguments (process all directories)
echo "No directories specified, running on all dirs listed in docker/scripts/pdm-lock-gen/pdm-lock.sh"
./docker/scripts/pdm-lock-gen/pdm-lock.sh
else
# Convert comma-separated list into an array of directories
IFS=',' read -r -a dir_array <<< "$dirs"
# Print directories being processed
echo "Processing specified directories: ${dir_array[*]}"
# Pass directories as command-line arguments to the script
./docker/scripts/pdm-lock-gen/pdm-lock.sh "${dir_array[@]}"
fi
shell: bash
- name: Commit pdm.lock changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Commit pdm.lock changes
commit_user_name: pdm-lock-automation[bot]
commit_user_email: [email protected]