Skip to content

Commit

Permalink
feat(renovate): automerge PRs for patch updates (#5252)
Browse files Browse the repository at this point in the history
* Enable automerge for non-major dep module updates

* Trigger integration tests on each renovatebot PR update

* Remove trailing space

* Set label for renovate PRs

* Enable rollback PRs

* Fix config: move rollbackPrs to proper place

* Fix workflow (trigger on push)

* Remove trailing space

* Automerge only patch version updates (except versions 0.x)

* Add packageRule for rollbackPrs

* Update renovate.json

---------

Co-authored-by: Ivan Nikiforov <[email protected]>
Co-authored-by: Christopher Fenner <[email protected]>
  • Loading branch information
3 people authored Feb 4, 2025
1 parent c5ab6a7 commit f720698
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@
"integration/testdata/**",
"test/resources/**"
],
"labels": [
"dependencies"
],
"packageRules": [
{
"description": "Create PRs to roll back Go module if the current version is not found in the registry.",
"matchManagers": ["gomod"],
"rollbackPrs": true
},
{
"description": "Automerge patch version updates for Go modules (except versions 0.x as they could have breaking changes)",
"matchManagers": ["gomod"],
"matchUpdateTypes": ["patch"],
"matchCurrentVersion": "!/^(v?0)/",
"automerge": true,
"addLabels": ["renovate-automerge"]
}
],
"postUpdateOptions": [
"gomodTidy",
"gomodUpdateImportPaths"
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/renovate-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Renovatebot - Trigger integration tests on PR update

on:
push:
branches:
- 'renovate/**'

jobs:
comment:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Post a comment on the PR
uses: actions/github-script@v7
with:
script: |
const branch = context.ref.replace('refs/heads/', '');
const repository = context.repo.repo;
const owner = context.repo.owner;
// Find PRs associated with the branch
const { data: pullRequests } = await github.rest.pulls.list({
owner: owner,
repo: repository,
head: `${owner}:${branch}`,
state: 'open'
});
// Post a comment to each found PR
for (const pr of pullRequests) {
await github.rest.issues.createComment({
issue_number: pr.number,
owner: owner,
repo: repository,
body: '/it-go'
});
}

0 comments on commit f720698

Please sign in to comment.