Skip to content

docs: add missing community standards #2

docs: add missing community standards

docs: add missing community standards #2

Workflow file for this run

name: Preview Build
on:
pull_request:
types: [labeled, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
preview:
if: contains(github.event.pull_request.labels.*.name, 'preview')
runs-on: ubuntu-latest
concurrency:
group: preview-${{ github.event.pull_request.number }}
cancel-in-progress: true
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Generate runtime adapters
run: node scripts/generate.js
- name: Check adapter drift
run: |
if ! git diff --exit-code --name-only; then
echo "::error::Preview drift detected"
git diff --stat
exit 1
fi
- name: Run full test suite
run: node --test tests/unit/*.test.js tests/transforms/*.test.js tests/integration/*.test.js
- name: Determine publish eligibility
id: publish_gate
run: |
if [ -n "$NPM_TOKEN" ]; then
echo "enabled=true" >> "$GITHUB_OUTPUT"
else
echo "enabled=false" >> "$GITHUB_OUTPUT"
fi
- name: Set preview version
if: steps.publish_gate.outputs.enabled == 'true'
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
BASE=$(node -p "require('./package.json').version")
SHORT_SHA=$(printf '%s' "$HEAD_SHA" | cut -c1-7)
PREVIEW="${BASE}-preview.${SHORT_SHA}"
npm version "$PREVIEW" --no-git-tag-version
- name: Publish preview
if: steps.publish_gate.outputs.enabled == 'true'
run: npm publish --tag preview --access public
env:
NODE_AUTH_TOKEN: ${{ env.NPM_TOKEN }}
- name: Upsert PR comment
if: steps.publish_gate.outputs.enabled == 'true'
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
VERSION=$(node -p "require('./package.json').version")
SHA="$HEAD_SHA"
BODY="Preview published: \`npm install @maestro-orchestrator/maestro@${VERSION}\`
Built from \`${SHA}\`"
EXISTING=$(gh api "repos/$REPOSITORY/issues/$PR_NUMBER/comments" \
--jq 'map(select(.body | startswith("Preview published:"))) | .[0].id')
if [ -n "$EXISTING" ] && [ "$EXISTING" != "null" ]; then
gh api "repos/$REPOSITORY/issues/comments/$EXISTING" \
-X PATCH \
-f body="$BODY"
else
gh api "repos/$REPOSITORY/issues/$PR_NUMBER/comments" \
-X POST \
-f body="$BODY"
fi