Skip to content

chore: responses API sample code #1399

chore: responses API sample code

chore: responses API sample code #1399

name: Build Cloud SDK Documentation
on:
pull_request:
branches: [main]
permissions: {}
jobs:
checks:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write # for review-dog comments
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Determine Changed Files
id: changed-files
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
ALL_FILES=$(gh pr view ${{ github.event.pull_request.number }} --json files --jq '.files.[] | select(.additions > 0) | .path')
CHANGED_FILES="${ALL_FILES//$'\n'/,}"
echo "[DEBUG] Following files have been changed: $CHANGED_FILES"
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_OUTPUT
- name: Vale Linter
# vale fails if the PR is too large, e.g. when updating API docs
if: ${{ github.event.pull_request.changed_files < 100 && steps.changed-files.outputs.CHANGED_FILES != '' }}
env:
# Required
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
uses: vale-cli/vale-action@85f9f7f2c5f449ac0ae5b66662961bae3f77ca6a # v2.1.2
with:
# version of 'vale' to use
# see https://github.com/vale-cli/vale for all releases
version: 3.14.1
# changed files. computed in the step above
files: ${{ steps.changed-files.outputs.CHANGED_FILES }}
# the separator for the file list. we are using a comma (see step above)
separator: ","
# let review dog fail if there are errors
fail_on_error: true
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 20
- id: cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: node_modules
key: ubuntu-latest-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: ESlint and Prettier
run: npm run lint
build:
runs-on: ubuntu-latest
needs: [checks]
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 20
- id: cache
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: node_modules
key: ubuntu-latest-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Build docs
run: npm run build
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request' }}
needs: [build]
permissions:
pull-requests: write
contents: write
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Approve a PR
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: gh pr review --approve "$PR_URL"
- name: Enable auto-merge for Dependabot PRs
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: gh pr merge --auto --squash "$PR_URL"