name: '🔄 Gemini CLI Bot: Pulse' on: schedule: - cron: '*/30 * * * *' # Every 30 minutes workflow_dispatch: concurrency: group: '${{ github.workflow }}-${{ github.ref }}' cancel-in-progress: true permissions: contents: 'write' issues: 'write' pull-requests: 'write' jobs: precheck: name: 'Pre-check' runs-on: 'ubuntu-latest' if: "github.repository == 'google-gemini/gemini-cli'" outputs: has_scripts: '${{ steps.check.outputs.has_scripts }}' steps: - name: 'Checkout' uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' # ratchet:actions/checkout@v5 with: fetch-depth: 1 # Shallow checkout for check - id: 'check' run: | if [ -d "tools/gemini-cli-bot/reflexes/scripts" ] && [ "$(ls -A tools/gemini-cli-bot/reflexes/scripts/*.ts 2>/dev/null)" ]; then echo "has_scripts=true" >> "$GITHUB_OUTPUT" else echo "has_scripts=false" >> "$GITHUB_OUTPUT" fi pulse: name: 'Pulse (Reflex Layer)' needs: 'precheck' if: "needs.precheck.outputs.has_scripts == 'true'" runs-on: 'ubuntu-latest' steps: - name: 'Checkout' uses: 'actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8' # ratchet:actions/checkout@v5 with: fetch-depth: 1 # Pulse doesn't need full history unless a script specifically asks for it. - name: 'Setup Node.js' uses: 'actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020' # ratchet:actions/setup-node@v4 with: node-version: '20' cache: 'npm' - name: 'Install dependencies' run: 'npm ci' - name: 'Run Reflex Processes' env: GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' run: | shopt -s nullglob for script in tools/gemini-cli-bot/reflexes/scripts/*.ts; do echo "Running reflex script: $script" npx tsx "$script" done