Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 するので、公開から日を置いて様子を見る理由がないためだ。
27 changes: 10 additions & 17 deletions default.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -73,6 +56,16 @@
"addLabels": [
"⚠️ production"
]
},
{
"description": "✅ Minor/Patch updates - enable automerge",
"matchUpdateTypes": [
"minor",
"patch",
"pin",
"digest"
],
"automerge": true
}
]
}
14 changes: 10 additions & 4 deletions scripts/workflows/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Loading