diff --git a/.github/workflows/generate.yaml b/.github/workflows/generate.yaml index 8da5945cea6..30ec1385ed8 100644 --- a/.github/workflows/generate.yaml +++ b/.github/workflows/generate.yaml @@ -43,46 +43,18 @@ jobs: pip install pip==21.3.1 pip --version - run: ./google-api-java-client-services/.github/workflows/generate.sh ${{ matrix.service }} - - name: Create PR via Local Checkout (Large Commit Support) - shell: bash - working-directory: google-api-java-client-services + - uses: googleapis/code-suggester@v5 env: - GH_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} - SERVICE: ${{ matrix.service }} - AUTHOR: "yoshi-code-bot " - BASE_REPO: "${{ github.repository }}" - run: | - set -ex - - # 1. Setup Identity - git config user.name "yoshi-code-bot" - git config user.email "yoshi-code-bot@google.com" - - # 2. Setup Remote Fork - git remote add fork "https://yoshi-code-bot:${GH_TOKEN}@github.com/yoshi-code-bot/google-api-java-client-services.git" - - # 3. Create Branch - BRANCH="regenerate-${SERVICE}" - git checkout -b "$BRANCH" - - # 4. Stage specific files (Large commit handling) - TARGET_PATH="clients/google-api-services-${SERVICE}" - git add "$TARGET_PATH" - - # 5. Commit & Push - MESSAGE="chore: regenerate ${SERVICE} client" - if git diff-index --quiet HEAD --; then - echo "No changes to commit for ${SERVICE}." - exit 0 - fi - - git commit -m "$MESSAGE" - git push fork "$BRANCH" --force - - gh pr create \ - --repo "$BASE_REPO" \ - --head "yoshi-code-bot:${BRANCH}" \ - --base "main" \ - --title "$MESSAGE" \ - --body "Generated in GitHub action: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ - || echo "PR already exists or failed to create, but changes are pushed." + ACCESS_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} + with: + command: pr + upstream_owner: ${{ github.repository_owner }} + upstream_repo: google-api-java-client-services + description: 'Generated in GitHub action: https://github.com/${{ github.repository_owner }}/${{ github.repository }}/actions/workflows/codegen.yaml' + title: 'chore: regenerate ${{ matrix.service }} client' + message: 'chore: regenerate ${{ matrix.service }} client' + branch: regenerate-${{ matrix.service }} + git_dir: 'google-api-java-client-services/clients/google-api-services-${{ matrix.service }}' + primary: main + force: true + fork: true