تخطَّ إلى المحتوى

Reusable GitHub Workflows

هذا المحتوى غير متوفر بلغتك بعد.

All nself-org repositories share a set of reusable GitHub Actions workflows hosted in the nself-org/.github repository. Calling these templates keeps CI/CD configuration consistent and reduces duplication.

TemplatePurposeKey Inputs
testRun the test suite with pnpmnode-version, working-directory, test-command
buildBuild the package and upload an artifactnode-version, working-directory, build-command
releaseBuild, test, and publish to npmnode-version, working-directory, publish-command
doc-syncVerify documentation is in sync with sourcenode-version, working-directory, check-command
clean-rootEnforce clean repository root (no stray Markdown)allowed-markdown
securityAudit dependencies, licenses, and secretsnode-version, working-directory, fail-on-severity

All inputs have sensible defaults so minimal configuration is required for standard pnpm packages.

  • pnpm is the required package manager (pnpm-lock.yaml must be present)
  • Node.js ≥ 18 (templates default to Node 20)
  • For the release template: add NPM_TOKEN as a repository or organization secret

Reference a template with uses: nself-org/.github/.github/workflows/<name>.yml@v1:

.github/workflows/ci.yml
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
uses: nself-org/.github/.github/workflows/test.yml@v1
with:
node-version: "22"
build:
needs: test
uses: nself-org/.github/.github/workflows/build.yml@v1
with:
node-version: "22"

A complete workflow using all six templates:

.github/workflows/ci.yml
name: CI / CD
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
jobs:
test:
uses: nself-org/.github/.github/workflows/test.yml@v1
with:
node-version: "22"
working-directory: "apps/my-package"
test-command: "pnpm run test:ci"
build:
uses: nself-org/.github/.github/workflows/build.yml@v1
with:
node-version: "22"
working-directory: "apps/my-package"
doc-sync:
uses: nself-org/.github/.github/workflows/doc-sync.yml@v1
with:
working-directory: "apps/my-package"
clean-root:
uses: nself-org/.github/.github/workflows/clean-root.yml@v1
security:
uses: nself-org/.github/.github/workflows/security.yml@v1
with:
working-directory: "apps/my-package"
fail-on-severity: "high"
release:
if: github.event_name == 'release'
needs: [test, build]
uses: nself-org/.github/.github/workflows/release.yml@v1
with:
node-version: "22"
working-directory: "apps/my-package"
secrets:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Templates are pinned to @v1. Breaking changes create a new major version tag (@v2). Improvements that do not break existing callers are applied in-place on the current major tag.

Templates live in workflow-templates/ in the nself-org/.github repository. Each template has a matching .properties.json file that enables discovery via the GitHub Actions UI (“Actions → New workflow”).