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
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ concurrency:
cancel-in-progress: true
jobs:
quality:
permissions:
contents: read
packages: read
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
Expand All @@ -20,6 +23,10 @@ jobs:
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
with:
node-version-file: .node-version
registry-url: https://npm.pkg.github.com
scope: '@commercekit-tools'
- run: corepack enable
- run: pnpm install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: pnpm quality
7 changes: 7 additions & 0 deletions .github/workflows/marketplace-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ concurrency:

jobs:
preflight:
permissions:
contents: read
packages: read
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
timeout-minutes: 20
Expand Down Expand Up @@ -80,8 +83,12 @@ jobs:
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
with:
node-version-file: .node-version
registry-url: https://npm.pkg.github.com
scope: '@commercekit-tools'
- run: corepack enable
- run: pnpm install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: pnpm quality

prepare-draft:
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@commercekit-tools:registry=https://npm.pkg.github.com
18 changes: 17 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Contributing

Use Node.js `24.21.0` and pnpm `12.6.0`. Enable Corepack, then run `pnpm install --frozen-lockfile`.
Use Node.js `24.21.0` and pnpm `12.6.0`. Configure GitHub Packages authentication as described below, enable Corepack, then run `pnpm install --frozen-lockfile`.

Run `pnpm format`, `pnpm lint`, `pnpm typecheck`, `pnpm schema:check`, `pnpm test`, `pnpm test:coverage`, `pnpm audit`, and `pnpm bundle`. Review contract changes and provider payload fixtures carefully. Update `dist/index.js` with source changes. Use only synthetic fixtures; normal CI must never call real webhooks. PRs should explain contract/security effects and include focused tests.

## GitHub Packages access

`@commercekit-tools/notification-contract` is pinned to `0.0.2`. The committed `.npmrc` contains only the scoped registry. Configure a classic GitHub PAT with `read:packages` in your user-level npm configuration, or supply `NODE_AUTH_TOKEN` through an external npm auth configuration. Never commit credentials or add a long-lived PAT repository secret.

```sh
npm login --scope=@commercekit-tools --registry=https://npm.pkg.github.com --auth-type=legacy
pnpm view @commercekit-tools/notification-contract@0.0.2 version --registry=https://npm.pkg.github.com
pnpm install --frozen-lockfile
```

If an IDE overrides your npm configuration, inspect `npm config get userconfig` and point `NPM_CONFIG_USERCONFIG` to your authenticated user-level file. Do not print its credentials.

CI and release preflight use the existing pinned setup-node action, job-level `contents: read` and `packages: read`, and `NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}` only on the install step. The Notify repository must have Actions read access to the package. CodeQL uses build-mode none and needs no package installation. Smoke workflows execute the bundled Action without package credentials.

`pnpm schema:check` verifies the exact installed package version, public schema export, all committed fixtures, supported event types and absence of a vendored schema. It uses installed files and makes no registry request. Keep golden snapshots unchanged during source deduplication. The local presentation sanitizer retains Notify's redaction wording and URL filtering because the generic package sanitizers are not equivalent.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Send a normalized CommerceKit workflow event to Slack Incoming Webhooks or Micro

The Action performs no CCv2 API calls, build/deployment work, CLI checks, project-file inspection, or source diagnostics. See [the event contract](docs/notification-event-v1.md).

## Shared event contract

NotificationEvent v1 is supplied by `@commercekit-tools/notification-contract`, pinned to **0.0.2** from GitHub Packages and bundled into `dist/index.js`. Workflow users do not install the package or authenticate to GitHub Packages. Maintainers need package read access to install development dependencies; see [Contributing](CONTRIBUTING.md).

Notify owns presentation templates, Slack/Teams rendering and escaping, webhook policies, delivery, retries, and Action inputs/outputs. Package SemVer, event `schemaVersion`, and Action releases evolve independently. Notify remains unreleased. See the [migration compatibility notes](docs/shared-contract-migration.md).

## Supported providers

- Slack Incoming Webhooks (`slack`)
Expand Down
4 changes: 3 additions & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ The Action release version (`v1.0.0`) and NotificationEvent schema version (`1`)

**Release hold:** Do not tag, create a GitHub Release, or publish this Action to Marketplace until the separate `commercekit-tools/ccv2-build` and `commercekit-tools/ccv2-deploy` Actions are built and their NotificationEvent v1 outputs have been validated with this notifier. This is a product release gate; the two producer Actions remain separate repositories and releases.

The Action bundles `@commercekit-tools/notification-contract@0.0.2` and its runtime dependencies. Package SemVer is independent of NotificationEvent `schemaVersion`. Maintainers and preflight CI need GitHub Packages read access as described in [Contributing](CONTRIBUTING.md); workflow users and manual provider smoke use the committed bundle without registry access. Package publication does not release this Action.

## Release order

1. Merge reviewed notification PRs and verify main CI and CodeQL are green.
2. Build and review the separate `ccv2-build` and `ccv2-deploy` Actions. Each must emit compact NotificationEvent v1 JSON as `notification-event` on success and failure before `core.setFailed(...)` where possible, without provider-specific rendering or webhook handling.
3. Validate both producer outputs against this repository's schema and confirm the resulting build and deployment events render and deliver through this Action in controlled integration tests with a mocked transport. Do not claim the producers are ready solely because their repositories exist.
3. Validate both producer outputs against the installed contract package's complete validator and confirm the resulting build and deployment events render and deliver through this Action in controlled integration tests with a mocked transport. Do not claim the producers are ready solely because their repositories exist.
4. Verify `.github/workflows/provider-smoke.yml` is present on the default branch.
5. Create a dedicated `provider-smoke` environment with protection/approval where available. Add only temporary `COMMERCEKIT_SLACK_TEST_WEBHOOK_URL` and `COMMERCEKIT_TEAMS_TEST_WORKFLOW_URL` secrets to that environment.
6. Run the Slack smoke fixtures described below.
Expand Down
2 changes: 2 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ Webhook URLs are credentials. Store them as GitHub Actions secrets and do not pl
Redaction is defense in depth and does not replace safe producer behavior. See [security details](docs/security.md).

Report vulnerabilities through GitHub private vulnerability reporting for this repository when available. Otherwise use GitHub's private security advisory reporting flow. Do not disclose exploit details in public issues.

NotificationEvent v1 parsing and validation are supplied by the bundled `@commercekit-tools/notification-contract@0.0.2`. Notify retains filesystem safety, provider escaping and redaction, webhook URL masking, destination restrictions, timeouts, redirects and delivery policy. Runtime workflow consumers need no registry credentials. Package credentials belong only in maintainer user configuration or the CI install step; never in repository files or the bundle.
2 changes: 1 addition & 1 deletion THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Third-party notices

The Action's bundled runtime includes `@actions/core`, Ajv, and `ajv-formats` with their transitive dependencies. The committed `dist/licenses.txt` contains the license text and notices emitted by `@vercel/ncc` for code incorporated into `dist/index.js`; distribute it with the bundle. `package.json` and `pnpm-lock.yaml` record exact direct and resolved dependencies. Development tools are used to build and validate the Action and are not required by Action consumers.
The Action's bundled runtime includes `@actions/core` and `@commercekit-tools/notification-contract@0.0.2`, including the contract package's Ajv and `ajv-formats` dependencies. The committed `dist/licenses.txt` contains the license text and notices emitted by `@vercel/ncc` for code incorporated into `dist/index.js`; distribute it with the bundle. `package.json` and `pnpm-lock.yaml` record exact direct and resolved dependencies. Development tools are used to build and validate the Action and are not required by Action consumers.

Before each release, regenerate the bundle and review `dist/licenses.txt` for changes alongside dependency updates.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions dist/licenses.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,31 @@ The above copyright notice and this permission notice shall be included in all c

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@commercekit-tools/notification-contract
MIT
MIT License

Copyright (c) 2026 CommerceKit contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


ajv
MIT
The MIT License (MIT)
Expand Down
4 changes: 2 additions & 2 deletions docs/notification-event-v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Check data may contain mode, changedFrom, filesChecked, errors, warnings, durati

All input is limited to 64 KiB. Strings and arrays have schema bounds. Additive unknown fields are ignored and never rendered; unknown event types and schema versions fail. Additive optional fields preserve v1; changed meaning or removed required fields require a new schema version. Event schema, Action, and producer versions evolve independently.

See [`../schema/notification-event-v1.schema.json`](../schema/notification-event-v1.schema.json) for machine-readable validation.
The machine-readable schema is available through the public `@commercekit-tools/notification-contract/schema` export (JSON import attribute required). Notify pins package version `0.0.2`; package SemVer and event schemaVersion are independent.

For `check.completed` with `success`, `warning`, or `failure`, `data.filesChecked`, `data.errors`, and `data.warnings` are required non-negative integers. They may be omitted for `cancelled` and `internal-error`. `context.runUrl`, like every event link, must be a bounded HTTPS URL without credentials or fragment. The Action may fill missing context fields from the documented GitHub Actions environment variables; it does not read the full GitHub event payload or copy arbitrary environment values.

Expand All @@ -20,4 +20,4 @@ The optional `links` array carries operational destinations supplied by the prod

The presentation calls the three operations **CommerceKit check**, **CCv2 build**, and **CCv2 deployment**. Across operations, common outcomes use the same title endings: **succeeded**, **failed**, **cancelled**, and **encountered an internal error**. The shared status theme supplies the same textual status and icon to Slack and Teams Workflows. **Completed with warnings** applies to checks; **action required** applies to deployments. A failed operation and an internal CommerceKit error remain distinct statuses. Operation-specific summaries and facts explain what happened without changing that outcome vocabulary.

The schema `$id` is a logical canonical identifier. The website endpoint is not currently a downloadable schema; retrieve the source from this public repository's [`schema/notification-event-v1.schema.json`](../schema/notification-event-v1.schema.json) until a separate website publication is completed. Runtime validation always uses the bundled local schema.
The schema `$id` is a logical canonical identifier, not a runtime download endpoint. Runtime validation uses the schema bundled from the installed contract package. This repository no longer vendors a separate schema.
29 changes: 29 additions & 0 deletions docs/shared-contract-migration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Shared contract migration

This migration moves the pre-extraction baseline `015479e4340f61598d2125532acf6474381ca976` to `@commercekit-tools/notification-contract@0.0.2`. Notify remains unreleased.

## Ownership inventory

| Previous implementation | Classification | Migration |
| ---------------------------------------------------------------- | ---------------------- | -------------------------------------------------------------------------------------------- |
| `schema/notification-event-v1.schema.json` | Package replacement | Removed; public package `./schema` export |
| `src/event/types.ts` contract types | Package replacement | Public package types; provider identifiers move to `src/delivery/types.ts` |
| `src/event/validate.ts` Ajv and semantic checks | Package replacement | Package validation with a safe diagnostic adapter |
| `src/event/parse.ts` | Mixed — split | Filesystem safeguards stay local; JSON parsing and validation use package |
| `src/event/enrich-context.ts` | Mixed — split | Package extraction/merge; adapter requires an explicit server and uses producer run metadata |
| `src/event/sanitize.ts` | Notify-specific — keep | Moved to presentation; existing marker wording, signed URL and webhook filtering retained |
| `scripts/schema-check.mjs` | Package replacement | Offline installed-version/schema/fixture compatibility check |
| Templates, themes, renderers, transport and destination policies | Notify-specific — keep | Locally owned |
| Action interface, preview tooling, smoke/release behavior | Notify-specific — keep | Locally owned; install jobs get read-only package access |

There were no schema updater/provenance scripts to remove. All imports use public package exports. Direct Ajv dependencies are removed; the package supplies its runtime dependencies transitively.

## Compatibility behavior

All 16 committed fixtures are covered by the existing 32 provider snapshots. They must remain unchanged. The original sanitizer is deliberately retained because package primitives use different redaction labels and do not replace Notify's signed-URL and webhook filtering. Provider text safety is not delegated to generic package sanitizers.

This migration adopts package 0.0.2's stricter validation: HTTPS links ending in an empty `#` are rejected, although the baseline accepted them. The package validator remains the single source of truth; the adapter does not bypass it. The shared package is not modified here.

Package errors do not expose Ajv diagnostic paths. The local adapter retains the invalid-JSON and byte-limit messages and uses bounded, input-free messages for schema/type/status/data and link errors. No invalid JSON is echoed. Validation failures remain fatal and occur before delivery.

The context adapter preserves producer values, fills safe missing metadata, requires an explicit runner server URL, and supports producer repository/run metadata when runner values are missing. The package also rejects C1 control characters in extracted metadata and requires an origin-only server URL; the baseline extractor accepted those metadata characters and HTTPS server path prefixes. This migration adopts those stricter context policies. Invalid runner metadata is omitted without overriding valid producer context.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
},
"dependencies": {
"@actions/core": "3.0.1",
"ajv": "8.20.0",
"ajv-formats": "3.0.1"
"@commercekit-tools/notification-contract": "0.0.2"
},
"devDependencies": {
"@eslint/js": "10.0.1",
Expand Down
18 changes: 12 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
minimumReleaseAgeExclude:
- '@commercekit-tools/notification-contract@0.0.2'
overrides:
minimatch: 11.0.1
Loading