Skip to content

Commit 250c8d2

Browse files
spazyCZclaude
andauthored
fix: simplify Claude workflows and TestPyPI publishing (#8)
* fix: harden monitor behavior and raise coverage * fix: quality gate agents comment-only, add test branch trigger - Remove auto-commit instructions from all three agents — contents: read prevents pushing commits on pull_request events - Agents now post PR comments with proposed fixes/snippets instead - Add test branch to workflow trigger (feature PRs target test, not main) Fixes Copilot review comments on PR #5. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: address PR review feedback * fix: simplify claude code review workflow * ci: auto-version testpypi publishes * ci: set testpypi environment * chore: ignore coverage artifacts * chore: use standard python gitignore * test: tighten swap fallback assertion * fix: pass github_token to claude-code-action to resolve permission denials --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e095bb7 commit 250c8d2

File tree

5 files changed

+102
-11
lines changed

5 files changed

+102
-11
lines changed

.github/workflows/claude-code-review.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
uses: anthropics/claude-code-action@v1
3131
with:
3232
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
33+
github_token: ${{ secrets.GITHUB_TOKEN }}
3334
prompt: |
3435
You are a code review agent for the ptop3 project.
3536

.github/workflows/claude-quality-gate.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
- uses: anthropics/claude-code-action@v1
2525
with:
2626
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
2728
prompt: |
2829
You are a test quality agent for the ptop3 project.
2930
@@ -55,6 +56,7 @@ jobs:
5556
- uses: anthropics/claude-code-action@v1
5657
with:
5758
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
59+
github_token: ${{ secrets.GITHUB_TOKEN }}
5860
prompt: |
5961
You are a documentation quality agent for the ptop3 project.
6062
@@ -92,6 +94,7 @@ jobs:
9294
- uses: anthropics/claude-code-action@v1
9395
with:
9496
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
97+
github_token: ${{ secrets.GITHUB_TOKEN }}
9598
prompt: |
9699
You are a code quality and security agent for the ptop3 project.
97100

.github/workflows/publish-testpypi.yml

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ jobs:
1515
publish:
1616
needs: [test]
1717
runs-on: ubuntu-latest
18+
environment: testpypi
1819
permissions:
1920
contents: read # checkout only
21+
id-token: write # required for Trusted Publishing
2022

2123
steps:
2224
- uses: actions/checkout@v4
@@ -27,7 +29,53 @@ jobs:
2729
python-version: "3.12"
2830

2931
- name: Install build tools
30-
run: pip install build
32+
run: pip install build packaging
33+
34+
- name: Set unique TestPyPI version
35+
env:
36+
RUN_NUMBER: ${{ github.run_number }}
37+
run: |
38+
python - <<'PY'
39+
import os
40+
import re
41+
from pathlib import Path
42+
43+
from packaging.version import Version
44+
45+
pyproject = Path("pyproject.toml")
46+
init_py = Path("ptop3/__init__.py")
47+
48+
pyproject_text = pyproject.read_text()
49+
match = re.search(r'^version = "([^"]+)"', pyproject_text, re.M)
50+
if not match:
51+
raise SystemExit("Could not find project version in pyproject.toml")
52+
53+
base = Version(match.group(1))
54+
test_version = f"{base.major}.{base.minor}.{base.micro + 1}.dev{os.environ['RUN_NUMBER']}"
55+
56+
pyproject.write_text(
57+
re.sub(
58+
r'^version = "[^"]+"',
59+
f'version = "{test_version}"',
60+
pyproject_text,
61+
count=1,
62+
flags=re.M,
63+
)
64+
)
65+
66+
init_text = init_py.read_text()
67+
init_py.write_text(
68+
re.sub(
69+
r'^__version__ = "[^"]+"',
70+
f'__version__ = "{test_version}"',
71+
init_text,
72+
count=1,
73+
flags=re.M,
74+
)
75+
)
76+
77+
print(f"Publishing TestPyPI version: {test_version}")
78+
PY
3179
3280
- name: Build package
3381
run: python -m build
@@ -36,5 +84,4 @@ jobs:
3684
uses: pypa/gh-action-pypi-publish@release/v1
3785
with:
3886
repository-url: https://test.pypi.org/legacy/
39-
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
4087
skip-existing: true

.gitignore

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,51 @@
11
__pycache__/
22
*.py[cod]
3-
*.egg-info/
4-
dist/
5-
build/
6-
.eggs/
3+
*$py.class
4+
5+
# Virtual environments
76
.venv/
87
venv/
9-
.mypy_cache/
10-
.ruff_cache/
11-
.pytest_cache/
8+
env/
9+
ENV/
10+
.python-version
11+
12+
# Packaging
13+
.Python
14+
build/
15+
dist/
16+
downloads/
17+
eggs/
18+
.eggs/
19+
lib/
20+
lib64/
21+
parts/
22+
sdist/
23+
var/
24+
wheels/
25+
share/python-wheels/
26+
pip-wheel-metadata/
1227
*.egg
28+
*.egg-info/
1329
MANIFEST
30+
31+
# Test and coverage outputs
32+
.coverage
33+
.coverage.*
34+
htmlcov/
35+
.pytest_cache/
36+
.hypothesis/
37+
.tox/
38+
.nox/
39+
coverage.xml
40+
*.cover
41+
*.py,cover
42+
43+
# Type checkers and linters
44+
.mypy_cache/
45+
.dmypy.json
46+
dmypy.json
47+
.pyre/
48+
.ruff_cache/
49+
50+
# Notebooks and local tooling
51+
.ipynb_checkpoints/

tests/test_swap_clean.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,12 @@ def test_swap_clean_file_by_file_fallback(tmp_path, capsys):
253253
safety_mb=1,
254254
meminfo_path=str(meminfo),
255255
swaps_path=str(swaps),
256-
)
256+
)
257257

258258
assert rc == 0
259-
assert "file-by-file" in capsys.readouterr().out
259+
captured = capsys.readouterr()
260+
assert "Not enough RAM to clean all swap at once. Trying file-by-file..." in captured.err
261+
assert "Swap clean completed (file-by-file)." in captured.out
260262
called_cmds = [call.args[0] for call in mock_run.call_args_list]
261263
assert ["swapoff", "/swap-b"] in called_cmds
262264
assert ["swapon", "/swap-b"] in called_cmds

0 commit comments

Comments
 (0)