Skip to content

Commit

Permalink
perf: refine automerge strategy (#404)
Browse files Browse the repository at this point in the history
Signed-off-by: l.feng <[email protected]>
  • Loading branch information
msclock authored Dec 8, 2024
1 parent 0ef672e commit ccfd649
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -975,5 +975,5 @@ jobs:
jobs: ${{ toJSON(needs) }}

- name: Approve pr if all jobs succeeded
if: contains(github.event.pull_request.labels.*.name, 'auto-approval')
if: contains(github.event.pull_request.labels.*.name, 'auto-approval') && contains(github.actor, '[bot]')
uses: hmarr/auto-approve-action@v4
3 changes: 2 additions & 1 deletion .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Renovate

on:
schedule:
- cron: '*/15 0-3 * * 1'
# Match renovate schedule:earlyMondays and schedule:automergeMonthly
- cron: '*/15 0-3 * * *'
workflow_dispatch:

jobs:
Expand Down
24 changes: 17 additions & 7 deletions .renovaterc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,29 @@
"extends": [
"config:recommended",
"helpers:pinGitHubActionDigests",
":enablePreCommit",
":maintainLockFilesWeekly"
":enablePreCommit"
],
"automergeType": "pr",
"automergeStrategy": "merge-commit",
"ignoreScripts": false,
"platformAutomerge": true,
"packageRules": [
{
"automerge": true,
"addLabels": [
"auto-approval"
],
"extends": [
"schedule:earlyMondays",
"schedule:automergeMonthly"
],
"matchUpdateTypes": [
"minor",
"patch",
"pin",
"digest"
]
},
{
"matchDepTypes": [
"action"
Expand Down Expand Up @@ -57,7 +72,6 @@
{
"description": "Group vcpkg.json baseline with auto-update",
"groupName": "group vcpkg-baseline",
"extends": ["schedule:automergeMonthly"],
"addLabels": [
"auto-approval",
"vcpkg-baseline"
Expand All @@ -69,7 +83,6 @@
"matchFileNames": [
"vcpkg.json"
],
"automerge": true,
"postUpgradeTasks": {
"commands": [
"find template -type f -name 'vcpkg.json.jinja' -exec sed -i 's|{{{currentDigest}}}|{{{newDigest}}}|g' {} +"
Expand All @@ -79,16 +92,13 @@
{
"description": "Group renovate docker tag and pre-commit-hooks tag",
"groupName": "renovate group",
"extends": ["schedule:automergeMonthly"],
"addLabels": [
"auto-approval",
"renovate"
],
"matchDatasources": [
"docker",
"github-tags"
],
"automerge": true,
"matchDepNames": [
"ghcr.io/renovatebot/renovate",
"renovate/renovate",
Expand Down
26 changes: 17 additions & 9 deletions template/.renovaterc.json.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,29 @@
[%- if repo_name == 'ss-cpp' or repo_platform == 'github' %]
"helpers:pinGitHubActionDigests",
[%- endif %]
":enablePreCommit",
":maintainLockFilesWeekly"
":enablePreCommit"
],
"automergeType": "pr",
"automergeStrategy": "merge-commit",
"ignoreScripts": false,
"platformAutomerge": true,
"packageRules": [
{
"automerge": true,
"addLabels": [
"auto-approval"
],
"extends": [
"schedule:earlyMondays",
"schedule:automergeMonthly"
],
"matchUpdateTypes": [
"minor",
"patch",
"pin",
"digest"
]
},
[%- if repo_name == 'ss-cpp' %]
{
"matchDepTypes": [
Expand Down Expand Up @@ -60,7 +75,6 @@
{
"description": "Group vcpkg.json baseline with auto-update",
"groupName": "group vcpkg-baseline",
"extends": ["schedule:automergeMonthly"],
"addLabels": [
[%- if repo_platform == 'github' %]
"auto-approval",
Expand All @@ -74,7 +88,6 @@
"matchFileNames": [
"vcpkg.json"
],
"automerge": true,
"postUpgradeTasks": {
"commands": [
"find template -type f -name 'vcpkg.json.jinja' -exec sed -i {{ '\'s|{{{currentDigest}}}|{{{newDigest}}}|g\'' }} {} +"
Expand All @@ -85,18 +98,13 @@
{
"description": "Group renovate docker tag and pre-commit-hooks tag",
"groupName": "renovate group",
"extends": ["schedule:automergeMonthly"],
"addLabels": [
[%- if repo_platform == 'github' %]
"auto-approval",
[%- endif %]
"renovate"
],
"matchDatasources": [
"docker",
"github-tags"
],
"automerge": true,
"matchDepNames": [
[%- if repo_platform == 'github' %]
"ghcr.io/renovatebot/renovate",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1023,5 +1023,5 @@ jobs:
jobs: {{ '${{ toJSON(needs) }}' }}

- name: Approve pr if all jobs succeeded
if: contains(github.event.pull_request.labels.*.name, 'auto-approval')
if: contains(github.event.pull_request.labels.*.name, 'auto-approval') && contains(github.actor, '[bot]')
uses: hmarr/auto-approve-action@v4
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Renovate

on:
schedule:
- cron: '*/15 0-3 * * 1'
# Match renovate schedule:earlyMondays and schedule:automergeMonthly
- cron: '*/15 0-3 * * *'
workflow_dispatch:

jobs:
Expand Down

0 comments on commit ccfd649

Please sign in to comment.