|
| 1 | +name: Update Go Dependencies |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run every Monday at 9:00 AM UTC |
| 6 | + - cron: '0 9 * * 1' |
| 7 | + workflow_dispatch: # Allow manual trigger |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + pull-requests: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + update-dependencies: |
| 15 | + name: Update Go Dependencies |
| 16 | + runs-on: ubuntu-24.04 |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v5 |
| 21 | + with: |
| 22 | + ref: master |
| 23 | + fetch-depth: 0 |
| 24 | + |
| 25 | + - name: Set up Go |
| 26 | + uses: actions/setup-go@v6 |
| 27 | + with: |
| 28 | + go-version: '1.25' |
| 29 | + |
| 30 | + - name: Update Go dependencies |
| 31 | + run: make update-go-deps |
| 32 | + |
| 33 | + - name: Tidy dependencies |
| 34 | + run: make tidy |
| 35 | + |
| 36 | + - name: Generate manifests |
| 37 | + run: make generate manifests |
| 38 | + |
| 39 | + - name: Format and lint fix |
| 40 | + run: make fmt lint-fix |
| 41 | + |
| 42 | + - name: Check for changes |
| 43 | + id: check_changes |
| 44 | + run: | |
| 45 | + if [ -n "$(git status --porcelain)" ]; then |
| 46 | + echo "has_changes=true" >> $GITHUB_OUTPUT |
| 47 | + else |
| 48 | + echo "has_changes=false" >> $GITHUB_OUTPUT |
| 49 | + fi |
| 50 | +
|
| 51 | + - name: Create Pull Request |
| 52 | + if: steps.check_changes.outputs.has_changes == 'true' |
| 53 | + id: create_pr |
| 54 | + uses: peter-evans/create-pull-request@v7 |
| 55 | + with: |
| 56 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + commit-message: 'chore(deps): update Go dependencies' |
| 58 | + title: 'chore(deps): update Go dependencies' |
| 59 | + body: | |
| 60 | + ## Automated Go Dependencies Update |
| 61 | +
|
| 62 | + This PR updates Go module dependencies to their latest versions. |
| 63 | +
|
| 64 | + ### Changes made: |
| 65 | + - Updated Go module dependencies via `make update-go-deps` |
| 66 | + - Regenerated manifests via `make generate manifests` |
| 67 | + - Applied formatting and linting fixes via `make fmt lint-fix` |
| 68 | +
|
| 69 | + Please review the changes and ensure all tests pass before merging. |
| 70 | + branch: automated/update-go-deps |
| 71 | + delete-branch: true |
| 72 | + labels: | |
| 73 | + dependencies |
| 74 | + go |
| 75 | + automated |
| 76 | +
|
| 77 | + - name: Trigger CI workflows for generated PR |
| 78 | + if: steps.check_changes.outputs.has_changes == 'true' && steps.create_pr.outputs.pull-request-number |
| 79 | + run: | |
| 80 | + curl -X POST \ |
| 81 | + -H "Accept: application/vnd.github.v3+json" \ |
| 82 | + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ |
| 83 | + https://api.github.com/repos/${{ github.repository }}/dispatches \ |
| 84 | + -d '{ |
| 85 | + "event_type": "run-tests-for-generated-pr", |
| 86 | + "client_payload": { |
| 87 | + "pr_number": "${{ steps.create_pr.outputs.pull-request-number }}", |
| 88 | + "pr_head_sha": "${{ steps.create_pr.outputs.pull-request-head-sha }}", |
| 89 | + "pr_branch": "automated/update-go-deps", |
| 90 | + "trigger_source": "update-go-deps" |
| 91 | + } |
| 92 | + }' |
| 93 | +
|
0 commit comments