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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15 changes: 15 additions & 0 deletions .github/scripts/dependabot_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 18 additions & 0 deletions .github/scripts/test_dependabot_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -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([]))

Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@stable
# A cache is worth having here for the same reason it was not for the Go build:
# this one compiles a hundred crates, and without it a tag build takes minutes.
- uses: ilammy/msvc-dev-cmd@v1
- uses: Swatinem/rust-cache@v2
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3
- run: python -m unittest discover -s .github/scripts
- name: Check dependency graph excludes vulnerable GLib
shell: pwsh
Expand All @@ -46,10 +46,10 @@ jobs:
needs: test
runs-on: windows-latest
steps:
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dtolnay/rust-toolchain@stable
- uses: ilammy/msvc-dev-cmd@v1
- uses: Swatinem/rust-cache@v2
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0 # v2.9.3

- name: Build
shell: pwsh
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:

Get-ChildItem dist | Select-Object Name, Length

- uses: actions/upload-artifact@v7
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: wbtray-windows
path: |
Expand All @@ -137,7 +137,7 @@ jobs:

- name: Publish release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v3
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
with:
files: |
dist/wbtray.exe
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-auto-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
runs-on: ubuntu-latest
steps:
# Only trusted default-branch code receives the write token.
- uses: actions/checkout@v7
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.event.repository.default_branch }}
persist-credentials: false
Expand Down
Loading
Loading