Periodic autoupdate Poetry lock file #20
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
# This is a workflow file for GitHub Actions that automatically updates | |
# the Poetry lock file and creates a pull request if changes are detected. | |
name: Periodic autoupdate Poetry lock file | |
on: | |
schedule: | |
- cron: "0 9 * * *" # UTC time, runs every day at 9:00 AM | |
jobs: | |
autoupdate-poetry-lock: | |
runs-on: ubuntu-latest | |
if: github.repository == 'ansible/eda-server' | |
permissions: | |
contents: write | |
pull-requests: write | |
outputs: | |
lock-changed: ${{ steps.lock-changed.outputs.lock-changed }} | |
steps: | |
- name: Checkout main branch | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
- name: Install Poetry | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
- name: Run poetry lock | |
run: poetry lock --no-update | |
- name: Check if lock file changed | |
id: lock-changed | |
run: | | |
if git diff --exit-code poetry.lock; then | |
echo "No changes detected" | |
echo "lock-changed=false" >> $GITHUB_OUTPUT | |
else | |
echo "Changes detected" | |
echo "lock-changed=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Create a Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
if: steps.lock-changed.outputs.lock-changed == 'true' | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: autoupdate-poetry-lock | |
base: main | |
title: "ci(bot): autoupdate poetry lock file" | |
body: "This PR updates the poetry lock file with the latest changes." | |
labels: "run-e2e" |