Skip to content

Accrue merged PR rewards with manual CoinPay settlement - #9

Merged
ralyodio merged 2 commits into
mainfrom
feat/merged-pr-accrual
Sep 13, 2026
Merged

ralyodio merged 2 commits into
mainfrom
feat/merged-pr-accrual

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Enrolled repositories now record one USD mill ($0.001) per qualifying merged PR. Ten merges earn one nominal cent. Accrual is prospective and idempotent, using the current base-repository PR identity and the deployed portal ledger contract.

Maintainers can inspect accrued, reserved, paid and available amounts with /coinpay balance, or explicitly reserve whole cents using /coinpay settle --wallet <verified-address> --blockchain USDC_POL. Checkout must be funded manually; a pending link or reservation never implies payment. Existing generic invoice commands remain separate and require their own credential permissions.

The reusable workflow handles only merged pull_request_target: closed events and authorized PR comments. It freshly checks GitHub identity/permissions, runs an immutable bundle without checking out PR code, and sends a repository-bound contribution key plus audience-bound GitHub OIDC to the fixed CoinPay origin. Consumer secrets use new COINPAY_CONTRIBUTIONS_* names to preserve existing application credentials.

Validation: typecheck, all 292 unit/flow tests, 30 actual workflow-script checks, reproducible bundle build, and nine compiled-Action journeys with real network connections denied. Covers replay, unsafe identities, fork event isolation, current permissions, strict rate/config, exact integer accounting, settlement recipient binding, inactive checkout states and safe transport errors.

Deployment order: deploy the portal ledger and enrollment first, then approve the immutable reusable-workflow pin in the portal and provision the dedicated consumer secrets/config. Source/bundle commit: f5a6996c43c7a825658a3daa3b0d9343e3bce11f; workflow pin commit: ad7a2bc74f8fbaad424d7c2b2ef82b555a7b7af5. No production ledger writes, comments or payments were made during these offline tests.

cwd:root,encoding:'utf8',timeout:15000,env:{PATH:process.env.PATH,
GITHUB_REPOSITORY:'acme/project',GITHUB_EVENT_NAME:comment?'issue_comment':'pull_request_target',GITHUB_EVENT_PATH:path.join(dir,'event.json'),GITHUB_OUTPUT:path.join(dir,'output'),
'INPUT_GITHUB-TOKEN':'fixture-github','INPUT_COINPAY-API-KEY':'fixture-scoped-key','INPUT_COINPAY-BUSINESS-ID':'fixture-business',
ACTIONS_ID_TOKEN_REQUEST_URL:'https://oidc.actions.invalid/token?fixture=true',ACTIONS_ID_TOKEN_REQUEST_TOKEN:'fixture-request-token',
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

1 finding(s)

LOW: 1

Severity Rule Location
LOW secret-generic-credential scripts/check-contribution-bundle.mjs:22

Snippets are redacted; ThreatCrush never prints matched credential material.

@ralyodio
ralyodio merged commit 8afe1fd into main Sep 13, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants