|
| 1 | +name: Update gemini-webapi |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 0 * * *' # Runs every day at midnight |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + update-dep: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + permissions: |
| 12 | + contents: write |
| 13 | + pull-requests: write |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + |
| 17 | + - name: Install uv |
| 18 | + uses: astral-sh/setup-uv@v5 |
| 19 | + with: |
| 20 | + version: "latest" |
| 21 | + |
| 22 | + - name: Update gemini-webapi |
| 23 | + id: update |
| 24 | + run: | |
| 25 | + # Update the package using uv, which handles pyproject.toml and uv.lock |
| 26 | + uv add --upgrade gemini-webapi |
| 27 | + |
| 28 | + if ! git diff --quiet; then |
| 29 | + # Extract the new version number for the PR title using uv pip show |
| 30 | + VERSION=$(uv pip show gemini-webapi | grep ^Version: | awk '{print $2}') |
| 31 | + if [ -z "$VERSION" ]; then |
| 32 | + echo "Error: Could not extract gemini-webapi version from pyproject.toml" >&2 |
| 33 | + exit 1 |
| 34 | + fi |
| 35 | + echo "gemini-webapi has been updated to version $VERSION" |
| 36 | + echo "updated=true" >> $GITHUB_OUTPUT |
| 37 | + else |
| 38 | + echo "No updates available for gemini-webapi" |
| 39 | + echo "updated=false" >> $GITHUB_OUTPUT |
| 40 | + exit 0 |
| 41 | + fi |
| 42 | + |
| 43 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 44 | +
|
| 45 | + - name: Create Pull Request |
| 46 | + if: steps.update.outputs.updated == 'true' |
| 47 | + uses: peter-evans/create-pull-request@v6 |
| 48 | + with: |
| 49 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 50 | + commit-message: ":arrow_up: update gemini-webapi to ${{ steps.update.outputs.version }}" |
| 51 | + title: ":arrow_up: update gemini-webapi to ${{ steps.update.outputs.version }}" |
| 52 | + body: | |
| 53 | + Update `gemini-webapi` to version `${{ steps.update.outputs.version }}`. |
| 54 | + |
| 55 | + Auto-generated by GitHub Actions using `uv`. |
| 56 | + branch: update-gemini-webapi |
| 57 | + base: main |
| 58 | + delete-branch: true |
| 59 | + labels: dependency, automated |
0 commit comments