diff --git a/pyproject.toml b/pyproject.toml index a693cbd..b15d4ff 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ dependencies = [ "pygithub>=2.6.1", "pyyaml>=6.0.2", "requests>=2.32.4", - "reretry>=0.11.8", + "tenacity>=9.1.2", "toml>=0.10.2", ] diff --git a/snakedeploy/prs.py b/snakedeploy/prs.py index c7c029e..acb77a9 100644 --- a/snakedeploy/prs.py +++ b/snakedeploy/prs.py @@ -2,10 +2,9 @@ import os import re from typing import Optional -from reretry import retry +from tenacity import retry, stop_after_attempt, wait_exponential from urllib3.util.retry import Retry -import github from github import Github, GithubException from snakedeploy.exceptions import UserError @@ -57,7 +56,7 @@ def __init__( def add_file(self, filepath, content, is_updated, msg): self.files.append(File(str(filepath), content, is_updated, msg)) - @retry(tries=2, delay=60) + @retry(stop=stop_after_attempt(2), wait=wait_exponential(multiplier=2, min=60)) def create(self): if not self.files: logger.info("No files to commit.") @@ -83,7 +82,7 @@ def create(self): try: # try to get sha if file exists sha = self.repo.get_contents(file.path, self.branch).sha - except github.GithubException.UnknownObjectException as e: + except GithubException.UnknownObjectException as e: if e.status != 404: raise e elif file.is_updated: diff --git a/snakedeploy/snakemake_wrappers.py b/snakedeploy/snakemake_wrappers.py index d2cff6e..589e790 100644 --- a/snakedeploy/snakemake_wrappers.py +++ b/snakedeploy/snakemake_wrappers.py @@ -188,6 +188,13 @@ def update_spec(matchobj): if create_prs: assert pr is not None + pr.add_file( + snakefile, + snakefile_content, + is_updated=True, + msg=f"perf: update {snakefile}.", + ) + pr.create() if create_prs and not per_snakefile_prs: diff --git a/snakedeploy/templates/plugins/release_please.yml.j2 b/snakedeploy/templates/plugins/release_please.yml.j2 index 2de80ae..8d1f36f 100644 --- a/snakedeploy/templates/plugins/release_please.yml.j2 +++ b/snakedeploy/templates/plugins/release_please.yml.j2 @@ -5,9 +5,6 @@ on: name: release-please -env: - PYTHON_VERSION: 3.11 - jobs: release-please: runs-on: ubuntu-latest @@ -32,8 +29,8 @@ jobs: - name: Setup pixi uses: prefix-dev/setup-pixi@v0 with: - cache: true - python-version: {{ "${{ env.PYTHON_VERSION }}" }} + cache: false + locked: false - name: Build source and wheel distribution + check build run: |