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
17 changes: 10 additions & 7 deletions .github/workflows/monthly_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ jobs:
owner: ${{ github.repository_owner }}
repositories: |
CryptoCodexAuditBridge
permission-contents: write
permission-actions: write

- name: Trigger Monthly Review Automation
if: success() && env.PUBLISH_ENABLED != 'false'
Expand Down Expand Up @@ -247,7 +247,7 @@ jobs:
token = os.environ.get("APP_TOKEN", "").strip() or os.environ.get("CODEX_AUDIT_DISPATCH_TOKEN", "").strip()
if not token:
raise RuntimeError(
"Codex review dispatch requires either a GitHub App token or CODEX_AUDIT_DISPATCH_TOKEN"
"Codex review workflow dispatch requires either a GitHub App token or CODEX_AUDIT_DISPATCH_TOKEN"
)
target_repository = os.environ["TARGET_REPOSITORY"].strip()
if not re.fullmatch(r"[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+", target_repository):
Expand All @@ -256,17 +256,20 @@ jobs:
if mode not in {"review_only", "review_and_fix"}:
raise RuntimeError(f"Unsupported Codex review mode: {mode}")
payload = {
"event_type": "monthly-review-created",
"client_payload": {
"ref": "main",
"inputs": {
"source_repo": os.environ["GITHUB_REPOSITORY"],
"source_ref": os.environ["GITHUB_REF_NAME"],
"issue_number": os.environ["ISSUE_NUMBER"],
"issue_url": os.environ["ISSUE_URL"],
"mode": mode,
"auto_merge": os.environ["AUTO_MERGE"].strip().lower() == "true",
"auto_merge": str(os.environ["AUTO_MERGE"].strip().lower() == "true").lower(),
},
}
status = dispatch(token, f"https://api.github.com/repos/{target_repository}/dispatches", payload)
status = dispatch(
token,
f"https://api.github.com/repos/{target_repository}/actions/workflows/selfhosted_monthly_review.yml/dispatches",
payload,
)
if status not in (201, 204):
raise RuntimeError(f"Unexpected Codex dispatch status: {status}")
print(
Expand Down
7 changes: 4 additions & 3 deletions tests/test_monthly_publish_workflow_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_monthly_review_issue_creation_does_not_require_gh_cli(self) -> None:
self.assertIn("CROSS_REPO_GITHUB_APP_PRIVATE_KEY", workflow)
self.assertIn("actions/create-github-app-token@v3", workflow)
self.assertIn("CryptoCodexAuditBridge", workflow)
self.assertIn("permission-contents: write", workflow)
self.assertIn("permission-actions: write", workflow)
self.assertIn("APP_TOKEN", workflow)
self.assertIn("Trigger Monthly Review Automation", workflow)
self.assertIn("CODEX_AUDIT_DISPATCH_TOKEN", workflow)
Expand All @@ -53,8 +53,9 @@ def test_monthly_review_issue_creation_does_not_require_gh_cli(self) -> None:
self.assertIn("Codex monthly review dispatch failed", workflow)
self.assertIn("legacy API review fallback", workflow)
self.assertIn("legacy API fallback is disabled", workflow)
self.assertIn("monthly-review-created", workflow)
self.assertIn("/repos/{target_repository}/dispatches", workflow)
self.assertIn("selfhosted_monthly_review.yml", workflow)
self.assertIn("/actions/workflows/selfhosted_monthly_review.yml/dispatches", workflow)
self.assertNotIn("/repos/{target_repository}/dispatches", workflow)
self.assertIn("LEGACY_API_REVIEW_ENABLED", workflow)
self.assertIn("/actions/workflows/ai_review.yml/dispatches", workflow)

Expand Down