Shared composite actions and reusable workflows for Braintree Web SDK repositories.
Setup Node.js from .nvmrc, install global npm, and optionally run npm ci.
steps:
- uses: actions/checkout@v6
- uses: braintree/web-sdk-github-actions/actions/setup-node@main
with:
install-dependencies: "true" # default: "true"
node-version-file: ".nvmrc" # default: ".nvmrc"
registry-url: "" # set when publishing to npmValidate CHANGELOG, bump npm version, create release branch + PR, merge, and tag.
steps:
- uses: actions/checkout@v6
- uses: braintree/web-sdk-github-actions/actions/version-bump@main
with:
version-type: "patch" # required: patch | minor | major
github-token: ${{ secrets.GITHUB_TOKEN }}Outputs: new-version — the bumped version string (without v prefix).
Requires permissions:
permissions:
contents: write
pull-requests: writeExtract release notes from CHANGELOG.md and create a GitHub release using gh CLI.
steps:
- uses: actions/checkout@v6
- uses: braintree/web-sdk-github-actions/actions/release-notes@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}Requires permissions:
permissions:
contents: writePublish package to npm with provenance.
steps:
- uses: actions/checkout@v6
- uses: braintree/web-sdk-github-actions/actions/npm-publish@main
with:
npm-token: ${{ secrets.BRAINTREE_NPM_ACCESS_TOKEN }}
registry-url: "https://registry.npmjs.org/" # defaultRequires permissions:
permissions:
id-token: write # for provenanceRun lint and tests. Replaces the ci.yml in 16+ repos.
# .github/workflows/ci.yml
name: "CI"
on:
push:
branches: [main]
pull_request:
branches: ["*"]
workflow_dispatch:
workflow_call:
jobs:
ci:
uses: braintree/web-sdk-github-actions/.github/workflows/ci.yml@main
# with: # all optional
# lint-command: "npx eslint . --ext .js,.ts" # default
# test-command: "npm test" # default
# runs-on: "ubuntu-latest" # default
# node-version-file: ".nvmrc" # defaultCommon overrides:
# For repos using prettier instead of eslint:
with:
lint-command: "npx prettier --check ."
# For repos with custom lint scripts:
with:
lint-command: "npm run lint"
# To skip linting:
with:
lint-command: ""
# For internal repos using PayPal runners:
with:
runs-on: "gh-2-core-ubuntu-latest"Full publish pipeline: CI → version bump → npm publish → GitHub release.
# .github/workflows/publish.yml
name: "Publish to npm"
run-name: Deploy ${{ github.repository }} to npmjs by @${{ github.actor }}
on:
workflow_dispatch:
inputs:
version_type:
description: "Version bump type (major, minor, patch)"
required: true
type: choice
options:
- patch
- minor
- major
jobs:
publish:
uses: braintree/web-sdk-github-actions/.github/workflows/publish.yml@main
with:
version-type: ${{ inputs.version_type }}
secrets:
npm-token: ${{ secrets.BRAINTREE_NPM_ACCESS_TOKEN }}This single file replaces the previous publish.yml + version-bump.yml + release-notes.yml (3 files → 1).
Mark and close stale issues, PRs, and branches.
# .github/workflows/stale-cleanup.yml
name: "Stale Cleanup"
on:
schedule:
- cron: "0 0 * * 3" # midnight Wednesdays
workflow_dispatch:
jobs:
cleanup:
uses: braintree/web-sdk-github-actions/.github/workflows/stale-cleanup.yml@main
# with: # all optional
# pr-days-stale: 14 # default
# pr-days-close: 7 # default
# issue-days-stale: 14 # default
# issue-days-close: 7 # default
# branch-days-stale: 21 # default
# branch-days-close: 7 # default
# exempt-branches: "^(main|gh-pages)$" # default
# exempt-pr-labels: "dependencies" # defaultRequire a Jira ticket link in PR body.
# .github/workflows/pr-jira-check.yml
name: "PR Jira Check"
on:
pull_request:
types: [opened, edited, reopened, synchronize, labeled]
jobs:
check:
uses: braintree/web-sdk-github-actions/.github/workflows/pr-jira-check.yml@main
# with:
# jira-url-pattern: 'https://paypal\.atlassian\.net/browse/[A-Z]+-[0-9]+'Skips bots, draft PRs, and PRs labeled no-jira.
.github/workflows/
├── ci.yml (~25 lines)
├── publish.yml (~50 lines)
├── version-bump.yml (~65 lines)
└── release-notes.yml (~40 lines)
.github/workflows/
├── ci.yml (~15 lines)
└── publish.yml (~20 lines)
- Replace
ci.ymlcontents with the CI reusable workflow call (see above) - Replace
publish.yml+version-bump.yml+release-notes.ymlwith the single publish workflow call - Delete
version-bump.ymlandrelease-notes.yml - Test: trigger CI on a PR, verify lint + tests run
- Test: trigger publish with
workflow_dispatch(use a patch bump on a test branch first)