Skip to content

Instantly share code, notes, and snippets.

@jiimaho
Last active February 22, 2026 19:17
Show Gist options
  • Select an option

  • Save jiimaho/0745449830200d15fad064a0b66c7ec4 to your computer and use it in GitHub Desktop.

Select an option

Save jiimaho/0745449830200d15fad064a0b66c7ec4 to your computer and use it in GitHub Desktop.
GitHub workflow action to update nuget packages. Runs the Claude Code action. The result is a PR. Put this fil at ./github/workflows in your project.
name: Update backend packages
on:
schedule:
# Run every Sunday at 13:00 UTC
- cron: '0 13 * * 0'
workflow_dispatch:
# Allow manual triggering for testing
permissions:
contents: write # Required for creating branches and commits
pull-requests: write # Required for creating pull requests
id-token: write # Required for Claude Code authentication
jobs:
update-packages:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full git history for better context
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
# Required for Testcontainers (Azurite) used in tests
- name: Verify Docker is running
run: docker info
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Run Claude Code to Update NuGet Packages
uses: anthropics/claude-code-action@v1
with:
show_full_output: true
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# Execute the nugetupdate slash command
prompt: /nugetupdate
# Allow required tools for package updates
claude_args: |
--model "opus"
--max-turns 200
--allowed-tools WebFetch,WebSearch,Read,Edit,Write,Glob,Grep,Bash(dotnet:*),Bash(git:*),Bash(gh:*),Bash(date:*),Bash(docker:*)
- name: Workflow Summary
if: always()
run: |
echo "## Backend Package Update Workflow" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Status**: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY
echo "**Triggered**: ${{ github.event_name }}" >> $GITHUB_STEP_SUMMARY
echo "**Run**: ${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Check if a PR was created
if gh pr list --head "nuget-updates/$(date +%Y-%m-%d)" --json number,url --jq '.[0].url' > /dev/null 2>&1; then
PR_URL=$(gh pr list --head "nuget-updates/$(date +%Y-%m-%d)" --json url --jq '.[0].url')
echo "**Pull Request**: $PR_URL" >> $GITHUB_STEP_SUMMARY
else
echo "**Pull Request**: No PR created (no updates needed or error occurred)" >> $GITHUB_STEP_SUMMARY
fi
env:
GH_TOKEN: ${{ github.token }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment