Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/uv-upgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Upgrade uv dependencies

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * MON'

jobs:
upgrade:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up uv
uses: astral-sh/setup-uv@v2

- name: Generate timestamp
id: timestamp
run: |
echo "date=$(date -u '+%Y-%m-%d')" >> "$GITHUB_OUTPUT"
echo "slug=$(date -u '+%Y%m%d-%H%M%S')" >> "$GITHUB_OUTPUT"
- name: Upgrade dependencies
id: upgrade
shell: bash
run: |
set -o pipefail
uv lock --upgrade 2>&1 | tee /tmp/uv-upgrade.log
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command captures output but doesn't check if uv lock --upgrade actually made any changes. Consider checking if the lock file was modified before creating a PR to avoid creating empty PRs when no upgrades are available. You could add a git diff check after this step to set a conditional flag.

Copilot uses AI. Check for mistakes.
{
echo "output<<'EOF'"
cat /tmp/uv-upgrade.log
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Create pull request
Comment on lines +36 to +37
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The create-pull-request action will succeed even when no changes exist, creating unnecessary workflow runs. Consider adding a condition to skip PR creation when there are no changes, or rely on the action's default behavior by not explicitly setting all parameters when changes might be empty.

Suggested change
- name: Create pull request
- name: Check for changes
id: changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "has_changes=true" >> "$GITHUB_OUTPUT"
else
echo "has_changes=false" >> "$GITHUB_OUTPUT"
fi
- name: Create pull request
if: steps.changes.outputs.has_changes == 'true'

Copilot uses AI. Check for mistakes.
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: upgrade uv dependencies"
committer: agent-lightning-bot <[email protected]>
author: agent-lightning-bot <[email protected]>
title: "chore: upgrade uv dependencies (${{ steps.timestamp.outputs.date }})"
body: |
Automated uv dependency upgrade.
```
${{ steps.upgrade.outputs.output }}
```
branch: chore/uv-dependency-upgrade-${{ steps.timestamp.outputs.slug }}
delete-branch: true
Comment on lines +10 to +52

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 6 days ago

To fix the issue, you should add an explicit permissions block to the workflow to grant only the minimum necessary permissions that the job requires. Since the workflow creates a pull request with changes (commits), the job needs contents: write and pull-requests: write permissions. To minimize risk, add the following block to the job ("upgrade"), immediately after runs-on: ubuntu-latest.
No other changes are required.
File to edit: .github/workflows/uv-upgrade.yml
Change: Add a permissions: block to the upgrade job, specifying only the necessary permissions.


Suggested changeset 1
.github/workflows/uv-upgrade.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/uv-upgrade.yml b/.github/workflows/uv-upgrade.yml
--- a/.github/workflows/uv-upgrade.yml
+++ b/.github/workflows/uv-upgrade.yml
@@ -8,6 +8,9 @@
 jobs:
   upgrade:
     runs-on: ubuntu-latest
+    permissions:
+      contents: write
+      pull-requests: write
 
     steps:
       - name: Check out repository
EOF
@@ -8,6 +8,9 @@
jobs:
upgrade:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Check out repository
Copilot is powered by AI and may make mistakes. Always verify output.