1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-02-07 13:42:23 +02:00

feat(renovate): automerge PRs for patch updates (#5252)

* 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 <ivan.nikiforov@sap.com>
Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
This commit is contained in:
Ivan Nikiforov 2025-02-04 13:39:32 +01:00 committed by GitHub
parent c5ab6a781e
commit f7206987fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 57 additions and 0 deletions

18
.github/renovate.json vendored
View File

@ -7,6 +7,24 @@
"integration/testdata/**", "integration/testdata/**",
"test/resources/**" "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": [ "postUpdateOptions": [
"gomodTidy", "gomodTidy",
"gomodUpdateImportPaths" "gomodUpdateImportPaths"

View File

@ -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'
});
}