Skip to content

Update Go Dependencies #8

Update Go Dependencies

Update Go Dependencies #8

name: Update Go Dependencies
on:
schedule:
# Run every Monday at 9:00 AM UTC
- cron: '0 9 * * 1'
workflow_dispatch: # Allow manual trigger
permissions:
contents: write
pull-requests: write
jobs:
update-dependencies:
name: Update Go Dependencies
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
ref: master
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.25'
- name: Update Go dependencies
run: make update-go-deps
- name: Tidy dependencies
run: make tidy
- name: Generate manifests
run: make generate manifests
- name: Format and lint fix
run: make fmt lint-fix
- name: Check for changes
id: check_changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "has_changes=true" >> $GITHUB_OUTPUT
else
echo "has_changes=false" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.check_changes.outputs.has_changes == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git checkout -b automated/update-go-deps
git add .
git commit -m "chore(deps): update Go dependencies"
git push origin automated/update-go-deps --force
- name: Create Pull Request with GitHub CLI
if: steps.check_changes.outputs.has_changes == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Check if PR already exists
if gh pr view automated/update-go-deps --json number --jq .number 2>/dev/null; then
echo "PR already exists, updating..."
gh pr edit automated/update-go-deps \
--title "chore(deps): update Go dependencies" \
--body "## Automated Go Dependencies Update
This PR updates Go module dependencies to their latest versions.
### Changes made:
- Updated Go module dependencies via \`make update-go-deps\`
- Regenerated manifests via \`make generate manifests\`
- Applied formatting and linting fixes via \`make fmt lint-fix\`
Please review the changes and ensure all tests pass before merging.
---
*Generated by https://github.com/adobe/koperator/blob/master/.github/workflows/update-go-deps.yml*"
else
echo "Creating new PR..."
gh pr create \
--title "chore(deps): update Go dependencies" \
--body "## Automated Go Dependencies Update
This PR updates Go module dependencies to their latest versions.
### Changes made:
- Updated Go module dependencies via \`make update-go-deps\`
- Regenerated manifests via \`make generate manifests\`
- Applied formatting and linting fixes via \`make fmt lint-fix\`
Please review the changes and ensure all tests pass before merging.
---
*Generated by https://github.com/adobe/koperator/blob/master/.github/workflows/update-go-deps.yml*" \
--head automated/update-go-deps \
--base master \
--label "dependencies,go,automated"
fi