Skip to content

Commit b282527

Browse files
committed
v2.0.0: ci, lefthook, license, readme rewrite, release workflow
1 parent 0b6c671 commit b282527

18 files changed

Lines changed: 1549 additions & 311 deletions

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
indent_style = space
9+
indent_size = 4
10+
11+
[*.{bat,cmd}]
12+
end_of_line = crlf
13+
14+
[*.{md,yml,yaml}]
15+
indent_size = 2

.gitattributes

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
* text=auto eol=lf
2+
3+
*.bat text eol=crlf
4+
*.cmd text eol=crlf
5+
*.ps1 text eol=crlf
6+
*.sh text eol=lf
7+
*.md text eol=lf
8+
*.yml text eol=lf
9+
*.yaml text eol=lf
10+
*.cff text eol=lf
11+
*.txt text eol=lf
12+
13+
*.png binary
14+
*.jpg binary
15+
*.ico binary
16+
17+
*.svg text
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Bug report
2+
description: An executable is still reaching the internet, or the script errored out.
3+
title: "[bug] "
4+
labels: ["bug"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to report this. Please attach the transcript log
10+
(`%TEMP%\WinMasterBlocker-*.log`). Reports without the log usually need a
11+
round-trip to triage; with the log, most issues are resolved on first reply.
12+
13+
- type: input
14+
id: windows-version
15+
attributes:
16+
label: Windows version
17+
description: "Run `winver` and paste the version string (for example, Windows 11 24H2 build 26100.4202)."
18+
placeholder: "Windows 11 24H2 build 26100.xxxx"
19+
validations:
20+
required: true
21+
22+
- type: input
23+
id: app
24+
attributes:
25+
label: Application and version
26+
description: "The vendor and the specific app + version that is still phoning home."
27+
placeholder: "Adobe Acrobat DC 2026.001.20245"
28+
validations:
29+
required: true
30+
31+
- type: input
32+
id: exe-path
33+
attributes:
34+
label: Full path to the offending executable
35+
placeholder: "C:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\acrocef_1\\acrocef.exe"
36+
validations:
37+
required: true
38+
39+
- type: dropdown
40+
id: ran-update
41+
attributes:
42+
label: After the most recent application update, did you re-run the script (or option 98)?
43+
options:
44+
- "Yes, re-ran after update"
45+
- "No, did not re-run after update"
46+
- "Not sure"
47+
validations:
48+
required: true
49+
50+
- type: textarea
51+
id: transcript
52+
attributes:
53+
label: Transcript log excerpt
54+
description: "Paste the contents of %TEMP%\\WinMasterBlocker-*.log, or the relevant section."
55+
render: text
56+
validations:
57+
required: false
58+
59+
- type: textarea
60+
id: extra
61+
attributes:
62+
label: Anything else worth knowing
63+
description: "Custom install path, non-default drive, group policy involvement, etc."
64+
validations:
65+
required: false

.github/workflows/ci.yml

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: ci-${{ github.ref }}
15+
cancel-in-progress: false
16+
17+
jobs:
18+
lint:
19+
name: lint + format + audit
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v6
23+
24+
- name: lint
25+
run: bash tools/lint-bat.sh WinMasterBlocker.bat
26+
27+
- name: format-check
28+
run: bash tools/format-check.sh WinMasterBlocker.bat
29+
30+
- name: audit-coverage
31+
run: bash tools/audit-coverage.sh WinMasterBlocker.bat
32+
33+
integration:
34+
name: WHATIF integration on Windows
35+
runs-on: windows-latest
36+
steps:
37+
- uses: actions/checkout@v6
38+
39+
- name: stage fake vendor tree
40+
shell: pwsh
41+
run: |
42+
$root = Join-Path $env:RUNNER_TEMP 'wmb-fake'
43+
New-Item -ItemType Directory -Force -Path $root | Out-Null
44+
45+
$adobe = Join-Path $root 'Program Files\Adobe\Acrobat DC\Acrobat\acrocef_1'
46+
New-Item -ItemType Directory -Force -Path $adobe | Out-Null
47+
New-Item -ItemType File -Force -Path (Join-Path $adobe 'acrocef.exe') | Out-Null
48+
49+
$rdr = Join-Path $root 'Program Files\Adobe\Reader DC\Reader'
50+
New-Item -ItemType Directory -Force -Path $rdr | Out-Null
51+
New-Item -ItemType File -Force -Path (Join-Path $rdr 'RdrCEF.exe') | Out-Null
52+
53+
New-Item -ItemType Directory -Force -Path (Join-Path $root 'Program Files (x86)\Adobe') | Out-Null
54+
New-Item -ItemType Directory -Force -Path (Join-Path $root 'Common Files\Adobe') | Out-Null
55+
New-Item -ItemType Directory -Force -Path (Join-Path $root 'Common Files (x86)\Adobe') | Out-Null
56+
New-Item -ItemType Directory -Force -Path (Join-Path $root 'ProgramData\Adobe') | Out-Null
57+
New-Item -ItemType Directory -Force -Path (Join-Path $root 'AppData\Local\Adobe') | Out-Null
58+
New-Item -ItemType Directory -Force -Path (Join-Path $root 'AppData\Roaming\Adobe') | Out-Null
59+
60+
"FAKE_ROOT=$root" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
61+
62+
- name: run script in WHATIF mode
63+
shell: cmd
64+
env:
65+
WHATIF: "1"
66+
WMB_VENDOR: "Adobe"
67+
WMB_QUIET: "1"
68+
# WMB_TEST_ROOT redirects every path lookup to the fake tree we
69+
# staged above. Cleaner than trying to override %ProgramFiles%
70+
# from the workflow: GitHub Actions Windows runners ignore
71+
# workflow-level overrides for well-known Windows system vars.
72+
WMB_TEST_ROOT: ${{ runner.temp }}\wmb-fake
73+
run: |
74+
echo 0& WinMasterBlocker.bat
75+
76+
- name: assert rules emitted in transcript
77+
shell: pwsh
78+
run: |
79+
$log = Get-ChildItem $env:TEMP -Filter 'WinMasterBlocker-*.log' | Sort-Object LastWriteTime -Descending | Select-Object -First 1
80+
if (-not $log) { Write-Error 'no transcript log produced'; exit 1 }
81+
Write-Host "transcript: $($log.FullName)"
82+
$body = Get-Content $log.FullName -Raw
83+
Write-Host "----- transcript -----"
84+
Write-Host $body
85+
Write-Host "----- /transcript -----"
86+
# Tightened: require an actual rule emission, not just a path walk.
87+
if ($body -notmatch 'add ".*acrocef.*Adobe-block"') { Write-Error 'transcript missing acrocef rule emission'; exit 1 }
88+
if ($body -notmatch 'add ".*RdrCEF.*Adobe-block"') { Write-Error 'transcript missing RdrCEF rule emission'; exit 1 }
89+
if ($body -notmatch 'WHATIF') { Write-Error 'transcript missing WHATIF marker'; exit 1 }
90+
Write-Host 'integration ok'
91+
92+
release:
93+
name: GitHub Release on version bump
94+
needs: [lint, integration]
95+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
96+
runs-on: ubuntu-latest
97+
permissions:
98+
contents: write
99+
steps:
100+
- uses: actions/checkout@v6
101+
with:
102+
fetch-depth: 0
103+
104+
- name: Extract WMB_VERSION
105+
id: ver
106+
run: |
107+
V=$(grep -oE 'WMB_VERSION=[0-9]+\.[0-9]+\.[0-9]+' WinMasterBlocker.bat | head -1 | cut -d= -f2)
108+
if [ -z "$V" ]; then
109+
echo "::error::WMB_VERSION not found in WinMasterBlocker.bat"
110+
exit 1
111+
fi
112+
echo "version=$V" >> "$GITHUB_OUTPUT"
113+
echo "tag=v$V" >> "$GITHUB_OUTPUT"
114+
echo "Script version: $V"
115+
116+
- name: Skip if release already exists
117+
id: check
118+
env:
119+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
120+
run: |
121+
if gh release view "${{ steps.ver.outputs.tag }}" >/dev/null 2>&1; then
122+
echo "exists=true" >> "$GITHUB_OUTPUT"
123+
echo "Release ${{ steps.ver.outputs.tag }} already exists, skipping."
124+
else
125+
echo "exists=false" >> "$GITHUB_OUTPUT"
126+
fi
127+
128+
- name: Verify CITATION.cff version matches
129+
if: steps.check.outputs.exists == 'false'
130+
run: |
131+
CFF=$(grep -oE '^version: "?[0-9]+\.[0-9]+\.[0-9]+"?' CITATION.cff | head -1 | awk '{print $2}' | tr -d '"')
132+
if [ "$CFF" != "${{ steps.ver.outputs.version }}" ]; then
133+
echo "::error::CITATION.cff version ($CFF) does not match WMB_VERSION (${{ steps.ver.outputs.version }})"
134+
exit 1
135+
fi
136+
137+
- name: SHA-256 checksums
138+
if: steps.check.outputs.exists == 'false'
139+
run: |
140+
sha256sum WinMasterBlocker.bat LICENSE CITATION.cff > SHA256SUMS.txt
141+
cat SHA256SUMS.txt
142+
143+
- name: Release notes since previous tag
144+
if: steps.check.outputs.exists == 'false'
145+
env:
146+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
147+
run: |
148+
PREV=$(gh release list --limit 1 --json tagName -q '.[0].tagName' 2>/dev/null || true)
149+
{
150+
echo "## Changes since ${PREV:-initial}"
151+
echo
152+
if [ -n "$PREV" ]; then
153+
git log --pretty='* %s (%h)' "${PREV}..HEAD"
154+
else
155+
git log --pretty='* %s (%h)'
156+
fi
157+
} > RELEASE_NOTES.md
158+
cat RELEASE_NOTES.md
159+
160+
- name: Publish release
161+
if: steps.check.outputs.exists == 'false'
162+
uses: softprops/action-gh-release@v3
163+
with:
164+
tag_name: ${{ steps.ver.outputs.tag }}
165+
name: WinMasterBlocker ${{ steps.ver.outputs.tag }}
166+
body_path: RELEASE_NOTES.md
167+
files: |
168+
WinMasterBlocker.bat
169+
LICENSE
170+
CITATION.cff
171+
SHA256SUMS.txt
172+
fail_on_unmatched_files: true
173+
make_latest: true

0 commit comments

Comments
 (0)