diff --git a/README.md b/README.md index a59aa89..d451281 100644 --- a/README.md +++ b/README.md @@ -31,5 +31,3 @@ jobs: `default.json` は、panicboat のリポジトリで共通の Renovate 設定を持つ。各リポジトリは `extends` にこの preset を書き、そのリポジトリ固有の rule だけを自分の `renovate.json` に残す。 他のリポジトリは `"extends": ["github>panicboat/.github"]` と書く。これは、別のリポジトリに置いた preset を参照する書式として Renovate の docs が示しているものだ。このリポジトリは `"extends": ["local>panicboat/.github"]` と書く。`local>` は対象のリポジトリと同じ platform にある preset を参照する書式で、github.com では `github>` と同じに解決される。 - -`panicboat/.github` への参照は `minimumReleaseAge` を待たずに更新する。共通の workflow は panicboat 自身が release するので、公開から日を置いて様子を見る理由がないためだ。 diff --git a/default.json b/default.json index fa41b52..dd91342 100644 --- a/default.json +++ b/default.json @@ -46,23 +46,6 @@ "📈 major-update" ] }, - { - "description": "✅ Minor/Patch updates - enable automerge", - "matchUpdateTypes": [ - "minor", - "patch", - "pin", - "digest" - ], - "automerge": true - }, - { - "description": "Shared workflows from panicboat/.github apply without waiting for a release age", - "matchPackageNames": [ - "panicboat/.github" - ], - "minimumReleaseAge": null - }, { "description": "🚫 Production environments - disable automerge", "matchFileNames": [ @@ -73,6 +56,16 @@ "addLabels": [ "⚠️ production" ] + }, + { + "description": "✅ Minor/Patch updates - enable automerge", + "matchUpdateTypes": [ + "minor", + "patch", + "pin", + "digest" + ], + "automerge": true } ] } diff --git a/scripts/workflows/test.sh b/scripts/workflows/test.sh index 1d035bb..3dca583 100755 --- a/scripts/workflows/test.sh +++ b/scripts/workflows/test.sh @@ -109,10 +109,16 @@ test_resolver_skips_label_resolver_without_a_pull_request() { assert_eq "needs.resolve.outputs.has-targets == 'true' &&" "$(yq '.jobs["deploy-terragrunt"].if' "${workflow}" | head -n 1)" } -test_renovate_keeps_production_out_of_automerge() { - # Renovate applies matching packageRules in order, so a later rule overrides the production rule. - assert_eq "false" "$(jq -r '[.packageRules[] | select(.automerge != null) | select(.matchFileNames // [] | index("**/production/**"))][0].automerge' "${repo_root}/default.json")" - assert_eq "production" "$(jq -r '[.packageRules[] | select(.automerge != null)] | last | if (.matchFileNames // [] | index("**/production/**")) != null then "production" else "other" end' "${repo_root}/default.json")" +test_renovate_automerges_production_except_major() { + # Renovate applies matching packageRules in order, so the last matching rule decides automerge. + local type expected + for type in major minor patch pin digest; do + case "${type}" in + major) expected="false" ;; + *) expected="true" ;; + esac + assert_eq "${expected}" "$(jq -r --arg type "${type}" '[.packageRules[] | select(.automerge != null) | select(.matchUpdateTypes // [$type] | index($type)) | select(.matchFileNames // ["**/production/**"] | index("**/production/**")) | select(.matchPackageNames // ["*"] | index("*"))] | last | .automerge' "${repo_root}/default.json")" + done } test_label_base_deploy_fails_when_the_pull_request_lookup_fails() {