diff --git a/.github/scripts/dependabot_merge.py b/.github/scripts/dependabot_merge.py index 2ac3362..036c0b4 100644 --- a/.github/scripts/dependabot_merge.py +++ b/.github/scripts/dependabot_merge.py @@ -33,6 +33,21 @@ def eligible_commits(commits): return False types = re.findall(r"(?m)^ update-type: (\S+)\s*$", metadata[1]) dependencies = re.findall(r"(?m)^- dependency-name: ", metadata[1]) + + # Requirement-only bumps omit update-type; trust only the signed, + # single-dependency subject with an unambiguous same-major increase. + if not types and len(dependencies) == 1 and "update-type:" not in metadata[1]: + subject = data["message"].splitlines()[0] + bump = re.fullmatch( + r"(?:[\w()/-]+: )?update (\S+) requirement from " + r">=(\d+\.\d+\.\d+) to >=(\d+\.\d+\.\d+)", subject, + re.IGNORECASE) + name = re.search(r"(?m)^- dependency-name: (\S+)\s*$", metadata[1]) + if bump and name and bump[1] == name[1]: + before = tuple(map(int, bump[2].split("."))) + after = tuple(map(int, bump[3].split("."))) + if after > before and after[0] == before[0]: + types = ["version-update:semver-minor"] if not types or len(types) != len(dependencies): return False if any(t not in {"version-update:semver-patch", diff --git a/.github/scripts/test_dependabot_merge.py b/.github/scripts/test_dependabot_merge.py index cdd4cbc..24ce33f 100644 --- a/.github/scripts/test_dependabot_merge.py +++ b/.github/scripts/test_dependabot_merge.py @@ -57,6 +57,24 @@ def test_unknown_update_type(self): "version-update:semver-minor", "unknown") self.assertFalse(eligible_commits([self.commit])) + + def test_signed_requirement_bump_without_update_type(self): + self.commit["commit"]["message"] = ( + "chore: update example requirement from >=7.6.0 to >=7.7.0\n\n" + "---\nupdated-dependencies:\n- dependency-name: example\n" + " dependency-type: direct:production\n...\n") + self.assertTrue(eligible_commits([self.commit])) + original = self.commit["commit"]["message"] + for old, new in [("7.7.0", "8.0.0"), ("7.7.0", "7.5.0"), + ("7.7.0", "7.7.0rc1"), ("update example", "update other"), + (">=7.7.0", "<8"), + ("...\n", " update-type: unknown\n...\n")]: + self.commit["commit"]["message"] = original.replace(old, new) + self.assertFalse(eligible_commits([self.commit]), new) + self.commit["commit"]["message"] = original + self.commit["commit"]["verification"]["verified"] = False + self.assertFalse(eligible_commits([self.commit])) + def test_empty_commits(self): self.assertFalse(eligible_commits([])) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7535827..6962416 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,13 +25,13 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 60 steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7 + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version-file: ./go.mod - - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7 + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.13" - name: Regression tests @@ -99,7 +99,7 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 @@ -152,7 +152,7 @@ jobs: # 不能用 `output/*` 之类的通配(会把 ./output/.git 也扫进来)。 - name: Publish GitHub Release if: steps.delta.outputs.skip != '1' - uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3 + uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 with: tag_name: ${{ env.RELEASE_TAG }} name: GeoIP 产物(滚动更新) @@ -195,7 +195,7 @@ jobs: # Seal is uploaded only after every binary/checksum upload succeeds. - name: Publish release snapshot seal last if: steps.delta.outputs.skip != '1' - uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3 + uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 with: tag_name: ${{ env.RELEASE_TAG }} files: output/snapshot-manifest.json diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 692074f..d1121da 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -26,7 +26,7 @@ jobs: runs-on: ubuntu-latest steps: # Only trusted default-branch code receives the write token. - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: ${{ github.event.repository.default_branch }} persist-credentials: false diff --git a/.github/workflows/dependency-validation.yml b/.github/workflows/dependency-validation.yml index 5cf449e..4494a50 100644 --- a/.github/workflows/dependency-validation.yml +++ b/.github/workflows/dependency-validation.yml @@ -13,13 +13,13 @@ jobs: validate: runs-on: ubuntu-latest steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: persist-credentials: false - - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7 + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 with: go-version-file: go.mod - - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7 + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 with: python-version: "3.13" - run: python -m pip install -r requirements-ci.txt diff --git a/.github/workflows/sync-cnb.yml b/.github/workflows/sync-cnb.yml index a40ef10..d5e2c63 100644 --- a/.github/workflows/sync-cnb.yml +++ b/.github/workflows/sync-cnb.yml @@ -35,7 +35,7 @@ jobs: steps: - name: 取出仓库 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: ref: main fetch-depth: 0