Update python packages #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update python packages | |
on: | |
workflow_dispatch: | |
# Schedule to run every Monday at 23:55 | |
schedule: | |
- cron: '55 23 * * 1' | |
workflow_call: | |
env: | |
TARGET_BRANCH_CHANGES: update-python-package-$(date --rfc-3339=date) | |
GH_TOKEN: ${{ github.token }} | |
jobs: | |
setup_infrastructure: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out Git repository | |
id: checkout_repo | |
uses: actions/checkout@v4 | |
- name: Setup python | |
if: ${{ success() }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' # install the python version needed | |
- name: Update python package versions | |
if: ${{ success() }} | |
run: | | |
cd config | |
rm -rf requirements.txt | |
python -m pip install pip-tools | |
pip-compile | |
- name: Commit and push changes | |
run: | | |
git add -A | |
git config user.email "btpgenaibot@users.noreply.github.com" | |
git config user.name "[genai bot] package updates" | |
git diff --quiet && git diff --staged --quiet || git commit -m "[genai bot] update python packages" | |
git branch ${{ env.TARGET_BRANCH_CHANGES }} | |
git push origin ${{ env.TARGET_BRANCH_CHANGES }} | |
- name: Create Pull Request | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
curl -sS https://webi.sh/gh | sh | |
source ~/.config/envman/PATH.env | |
gh pr create --base main --head ${{ env.TARGET_BRANCH_CHANGES }} --title "Auto-update python packages" --body "This PR updates the python packages in the project" --label "enhancement" |