# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: ADK Stale Issue Auditor

on:
  workflow_dispatch:

  schedule:
    # This runs at 6:00 AM UTC (10 PM PST)
    - cron: '0 6 * * *'

jobs:
  audit-stale-issues:
    runs-on: ubuntu-latest
    timeout-minutes: 60

    permissions:
      issues: write
      contents: read

    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Set up Python
        uses: actions/setup-python@v6
        with:
          python-version: '3.11'

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install requests google-adk

      - name: Run Auditor Agent Script
        env:
          GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
          GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
          OWNER: ${{ github.repository_owner }}
          REPO: adk-python
          CONCURRENCY_LIMIT: 3
          LLM_MODEL_NAME: "gemini-2.5-flash"
          PYTHONPATH: contributing/samples

        run: python -m adk_stale_agent.main