Skip to content

feat(harness): add a Gemini CLI harness (tap, turn, and init templates) #1930

feat(harness): add a Gemini CLI harness (tap, turn, and init templates)

feat(harness): add a Gemini CLI harness (tap, turn, and init templates) #1930

Workflow file for this run

name: Lint PR
on:
pull_request:
types:
- opened
- edited
- synchronize
- reopened
env:
# This repo's own SDK automation App's bot, exempt from the title check below.
#
# Matched by the bot user's numeric ID, not its login. A GitHub App bot's login
# follows the App's name, so renaming the App renamed its bot and silently broke
# the previous login-based entry. Worse, the old name was then free to register,
# so any App that took it would have inherited the exemption. A user ID never
# changes and is never reused.
SDK_AUTOMATION_BOT_ID: '333044712'
# The release App's bot, which opens the release-please pull requests. Exempt
# from the title check too, and matched by ID for the same reasons.
RELEASE_BOT_ID: '335733747'
jobs:
validate-pr-title:
name: Validate PR title (Conventional Commits)
runs-on: ubuntu-latest
steps:
- name: Check Conventional Commits format
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
PR_AUTHOR_ID: ${{ github.event.pull_request.user.id }}
run: |
# Exempt automated PRs (Stainless codegen, release-please, dependabot, etc.).
# These bots may not always emit Conventional-Commits-formatted titles
# (dependabot's default "Bump foo from 1.0 to 1.1" doesn't match) and we
# don't want their PRs blocked by this check.
#
# This repo's own automation Apps are exempt too, matched by ID through
# SDK_AUTOMATION_BOT_ID and RELEASE_BOT_ID at the top of this file. The SDK
# automation App opens the promote pull requests. release-please runs here as
# a CLI under the release App rather than as the release-please[bot] GitHub
# App, so its release pull requests are authored by that App's bot and the
# list below never matched them. Their titles come from release-please's
# configured pull-request-title-pattern, which is not always a Conventional
# Commits type and cannot be changed without also changing the string
# release-please parses back when it cuts the release.
if [ "$PR_AUTHOR_ID" = "$SDK_AUTOMATION_BOT_ID" ] || [ "$PR_AUTHOR_ID" = "$RELEASE_BOT_ID" ]; then
echo "PR is from this repo's own automation ($PR_AUTHOR); skipping title check."
exit 0
fi
case "$PR_AUTHOR" in
stainless-app|stainless-app\[bot\]|release-please\[bot\]|github-actions\[bot\]|dependabot\[bot\])
echo "PR is from automation ($PR_AUTHOR); skipping title check."
exit 0
;;
esac
# Conventional Commits: <type>(<optional-scope>)(!): <subject>
PATTERN='^(feat|fix|docs|style|refactor|test|chore|ci|build|perf|revert)(\([^)]+\))?!?: .+'
if printf '%s' "$PR_TITLE" | grep -qE "$PATTERN"; then
echo "PR title is a valid Conventional Commit: $PR_TITLE"
exit 0
fi
# ::error must be on stdout for GitHub Actions to surface it as an annotation.
echo "::error title=Invalid PR title::PR title must follow Conventional Commits format. Got: $PR_TITLE"
{
echo " Got: $PR_TITLE"
echo " Expected: <type>(<optional-scope>)(!): <subject>"
echo " Types: feat, fix, docs, style, refactor, test, chore, ci, build, perf, revert"
echo ""
echo " Examples:"
echo " feat: add new endpoint"
echo " fix(client): handle empty response"
echo " chore!: drop python 3.11 support"
} >&2
exit 1