Skip to content

Commit

Permalink
Merge pull request #40 from AdrianDsg/adriandsg/add-update-workflow
Browse files Browse the repository at this point in the history
add ci workflow to upgrade pip dependencies
  • Loading branch information
MousaZeidBaker committed Nov 6, 2023
2 parents 8dbafd2 + 185cd92 commit 2d4246f
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
71 changes: 71 additions & 0 deletions .github/workflows/upgrade_pip_dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Upgrade pip dependencies

on:
schedule:
# first day of the month at 05:05AM
- cron: "5 5 1 * *"

workflow_dispatch:

jobs:
upgrade:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install poetry
uses: snok/install-poetry@v1
with:
version: 1.6.0

- name: Install dependencies
run: poetry install

- name: Upgrade dependencies
run: |
source $(poetry env info --path)/bin/activate
poetry up
- name: create pull request body
id: pr-body
run: |
diff_str=$(git diff poetry.lock || echo "")
pr_body=$(echo "$diff_str" | grep -E "name\s*=\s*\"" | sed "s/^\s*name\s*=\s*\"\([^\"]*\)\"\s*$/\* [\`\1\`](https:\/\/pypi.org\/project\/\1\)/g")
pr_body="## Upgrade pip dependencies\n\nThis **pull request** upgrades:\n\n$pr_body\n\nThe list items above have been pulled from the \`poetry.lock\` file.\n\nThe pull request will be updated by subsequent runs of the GitHub Actions workflow that generated it.\n"
echo -e "\n----------------------\nThe pull request body:\n----------------------\n"
echo -e "$pr_body"
echo 'pr_body<<EOF' >> $GITHUB_OUTPUT
echo -e "$pr_body" >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
add-paths: |
poetry.lock
pyproject.toml
commit-message: "chore(deps): upgrade pip dependencies"
branch: upgrade-pip-dependencies
delete-branch: true
base: master
title: "Upgrade pip dependencies"
body: ${{ steps.pr-body.outputs.pr_body }}
labels: |
dependencies
python
draft: false

0 comments on commit 2d4246f

Please sign in to comment.