Skip to content

Conversation

@ultmaster
Copy link
Contributor

Summary

  • capture the raw uv lock --upgrade output for use in the automated PR description
  • timestamp the generated branch and PR title while updating the schedule to run at 0 0 * * MON
  • configure the workflow to author commits with the agent-lightning-bot email address

Testing

  • git status -sb

https://chatgpt.com/codex/tasks/task_e_69017e4b88e8832e8f05de93d4bc448d

Copilot AI review requested due to automatic review settings October 29, 2025 04:50
Comment on lines +10 to +52
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
{
echo "output<<'EOF'"
cat /tmp/uv-upgrade.log
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Create pull request
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

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.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces an automated workflow for upgrading UV dependencies on a weekly schedule. The workflow creates pull requests with the upgrade results, streamlining the dependency maintenance process.

  • Adds a GitHub Actions workflow that runs weekly on Mondays to upgrade UV dependencies
  • Implements automatic PR creation with upgrade logs included in the PR body
  • Configures the workflow to use a bot account for commits and PR authorship

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.
Comment on lines +36 to +37
- name: Create pull request
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants