From f8502b912a4224720cf52b36b65b5e8b1309746a Mon Sep 17 00:00:00 2001 From: Yasunobu <42543015+P4suta@users.noreply.github.com> Date: Sun, 27 Sep 2026 04:45:21 +0900 Subject: [PATCH] chore(ci): remove obsolete Dependabot policy --- .../scripts/dependabot-auto-merge-policy.jq | 42 ------------ .../test-dependabot-auto-merge-policy.sh | 68 ------------------- .github/workflows/ci.yml | 3 - 3 files changed, 113 deletions(-) delete mode 100644 .github/scripts/dependabot-auto-merge-policy.jq delete mode 100644 .github/scripts/test-dependabot-auto-merge-policy.sh diff --git a/.github/scripts/dependabot-auto-merge-policy.jq b/.github/scripts/dependabot-auto-merge-policy.jq deleted file mode 100644 index b4eb834..0000000 --- a/.github/scripts/dependabot-auto-merge-policy.jq +++ /dev/null @@ -1,42 +0,0 @@ -def previous_version: - ( - try ( - tostring - | sub("^v"; "") - | capture("^(?[0-9]+)[.](?[0-9]+)(?:[.]|$)") - | { - major: (.major | tonumber), - minor: (.minor | tonumber) - } - ) catch null - ) // null; - -type == "array" and length > 0 and -all(.[]; - (.prevVersion | previous_version) as $previous | - (.packageEcosystem == "cargo" or .packageEcosystem == "github-actions") and - .dependencyName != "dependabot/fetch-metadata" and - .dependencyName != "actions/create-github-app-token" and - .dependencyName != "release-plz/action" and - .dependencyName != "rust-lang/crates-io-auth-action" and - .maintainerChanges == false and - ( - ( - .updateType == "version-update:semver-patch" and - $previous != null and - ( - $previous.major >= 1 or - ( - .packageEcosystem == "cargo" and - $previous.major == 0 and - $previous.minor >= 1 - ) - ) - ) or - ( - .updateType == "version-update:semver-minor" and - $previous != null and - $previous.major >= 1 - ) - ) -) diff --git a/.github/scripts/test-dependabot-auto-merge-policy.sh b/.github/scripts/test-dependabot-auto-merge-policy.sh deleted file mode 100644 index 1c2e40c..0000000 --- a/.github/scripts/test-dependabot-auto-merge-policy.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env bash -set -euo pipefail - -policy=.github/scripts/dependabot-auto-merge-policy.jq - -update() { - jq -cn \ - --arg ecosystem "$1" \ - --arg update_type "$2" \ - --arg previous "$3" \ - --argjson maintainer_changes "$4" \ - --arg dependency_name "${5:-example/dependency}" \ - '[{ - dependencyName: $dependency_name, - packageEcosystem: $ecosystem, - updateType: $update_type, - prevVersion: $previous, - maintainerChanges: $maintainer_changes - }]' -} - -expect() { - local expected=$1 - local description=$2 - local input=$3 - local actual=false - - if jq -e -f "$policy" <<<"$input" > /dev/null; then - actual=true - fi - if [[ "$actual" != "$expected" ]]; then - echo "$description: expected $expected, got $actual" >&2 - exit 1 - fi -} - -cargo_patch=$(update cargo version-update:semver-patch 0.1.0 false) -cargo_stable_minor=$(update cargo version-update:semver-minor 1.2.3 false) -actions_minor=$(update github-actions version-update:semver-minor v6.0.0 false) - -expect true "Cargo 0.x patch" "$cargo_patch" -expect true "Cargo stable minor" "$cargo_stable_minor" -expect true "GitHub Actions minor" "$actions_minor" -expect true "compatible group" "$(jq -cn --argjson a "$cargo_patch" --argjson b "$actions_minor" '$a + $b')" - -expect false "Cargo 0.x minor" "$(update cargo version-update:semver-minor 0.1.0 false)" -expect false "Cargo 0.0.x patch" "$(update cargo version-update:semver-patch 0.0.3 false)" -expect false "GitHub Actions 0.x patch" "$( - update github-actions version-update:semver-patch v0.5.1 false -)" -expect false "major update" "$(update cargo version-update:semver-major 1.2.3 false)" -expect false "same-version or digest update" "$(update github-actions '' v6.0.0 false)" -expect false "maintainer changes" "$(update cargo version-update:semver-patch 1.2.3 true)" -expect false "unparsable Cargo version" "$(update cargo version-update:semver-minor main false)" -expect false "unknown ecosystem" "$(update npm version-update:semver-patch 1.2.3 false)" -expect false "credential-bearing Action" "$( - update github-actions version-update:semver-patch v3.2.0 false actions/create-github-app-token -)" -expect false "auto-merge metadata Action" "$( - update github-actions version-update:semver-patch v3.1.0 false dependabot/fetch-metadata -)" -expect false "empty metadata" '[]' -expect false "group containing a major" "$( - jq -cn \ - --argjson a "$cargo_patch" \ - --argjson b "$(update cargo version-update:semver-major 1.2.3 false)" \ - '$a + $b' -)" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2422885..a80ad9a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,9 +30,6 @@ jobs: toolchain: 1.97.1 - run: go install github.com/rhysd/actionlint/cmd/actionlint@v1.7.12 - run: actionlint - - name: Test guarded Dependabot auto-merge policy - shell: bash - run: bash ./.github/scripts/test-dependabot-auto-merge-policy.sh - name: Test release metadata rejection cases shell: pwsh run: ./.github/scripts/test-release-metadata.ps1