Add alias command for creating extra CLI names #50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Validate | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| concurrency: | |
| group: pr-validate-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| checks: | |
| name: Validate (typecheck, format, build, test) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| env: | |
| GOOGLE_CLIENT_ID: test-client-id | |
| GOOGLE_CLIENT_SECRET: test-client-secret | |
| NO_UPDATE_NOTIFIER: "true" | |
| CI: "true" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Typecheck | |
| run: pnpm run typecheck | |
| - name: Check formatting | |
| run: pnpm exec prettier . --check | |
| - name: Build project | |
| run: pnpm run build | |
| - name: Test | |
| run: pnpm test | |
| lint: | |
| name: Cognitive complexity | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Lint (cognitive complexity) | |
| run: pnpm run lint:ci | |
| publish-preview: | |
| name: Publish preview | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install semver CLI | |
| run: npm install -g semver | |
| - name: Detect publish on merge | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| run: | | |
| HEAD_VERSION=$(node -p "require('./package.json').version") | |
| PACKAGE_NAME=$(node -p "require('./package.json').name") | |
| git show "${BASE_SHA}:package.json" > /tmp/base-package.json | |
| BASE_VERSION=$(node -p "require('/tmp/base-package.json').version") | |
| echo "Package: $PACKAGE_NAME" | |
| echo "Base: $BASE_VERSION" | |
| echo "Head: $HEAD_VERSION" | |
| if ! semver "$HEAD_VERSION" >/dev/null; then | |
| echo "::error::Head version '$HEAD_VERSION' is not valid semver." | |
| { | |
| echo "### Invalid version" | |
| echo "" | |
| echo "\`$HEAD_VERSION\` is not a valid semver string." | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| exit 1 | |
| fi | |
| if [ "$HEAD_VERSION" != "$BASE_VERSION" ] && ! semver "$HEAD_VERSION" -r ">$BASE_VERSION" >/dev/null; then | |
| echo "::error::Version change $BASE_VERSION -> $HEAD_VERSION is not a valid forward bump." | |
| { | |
| echo "### Invalid version bump" | |
| echo "" | |
| echo "\`$BASE_VERSION\` -> \`$HEAD_VERSION\` is not a valid forward semver bump." | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| exit 1 | |
| fi | |
| PUBLISHED=$(npm view "${PACKAGE_NAME}@${HEAD_VERSION}" version 2>/dev/null || true) | |
| if [ -n "$PUBLISHED" ]; then | |
| if [ "$HEAD_VERSION" = "$BASE_VERSION" ]; then | |
| { | |
| echo "### No publish on merge" | |
| echo "" | |
| echo "Version pinned at \`$HEAD_VERSION\` and already published on NPM — merging will not publish \`$PACKAGE_NAME\`." | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| exit 0 | |
| fi | |
| echo "::error::Version $HEAD_VERSION is already published on NPM." | |
| { | |
| echo "### Invalid version bump" | |
| echo "" | |
| echo "Version \`$HEAD_VERSION\` is already published on NPM. Bump to a new unpublished version." | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| exit 1 | |
| fi | |
| if [ "$HEAD_VERSION" = "$BASE_VERSION" ]; then | |
| { | |
| echo "### Will publish on merge" | |
| echo "" | |
| echo "Version pinned at \`$HEAD_VERSION\` but not yet published on NPM — merging will publish \`${PACKAGE_NAME}@${HEAD_VERSION}\`." | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| exit 0 | |
| fi | |
| { | |
| echo "### Will publish on merge" | |
| echo "" | |
| echo "Merging will publish \`${PACKAGE_NAME}@${HEAD_VERSION}\` (bumped from \`$BASE_VERSION\`)." | |
| } >> "$GITHUB_STEP_SUMMARY" |