From bc4b051d4298ef2be8c242f4296833f8831f208b Mon Sep 17 00:00:00 2001 From: Diego Marquez Date: Wed, 17 Jan 2024 15:59:26 -0500 Subject: [PATCH 1/4] Use `CLOUD_JAVA_BOT_TOKEN` in generate_new_client.yaml --- .github/workflows/generate_new_client.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate_new_client.yaml b/.github/workflows/generate_new_client.yaml index 422a3b6c8993..7c6892611dc2 100644 --- a/.github/workflows/generate_new_client.yaml +++ b/.github/workflows/generate_new_client.yaml @@ -100,7 +100,7 @@ jobs: echo "::set-output name=new_library_args::${arguments}" echo "${arguments} --googleapis-gen-url=\"${GOOGLEAPIS_GEN_URL}\"" | xargs python generation/new_client/new-client.py generate env: - GOOGLEAPIS_GEN_URL: https://yoshi-approver:${{ secrets.YOSHI_CODE_BOT_TOKEN }}@github.com/googleapis/googleapis-gen.git + GOOGLEAPIS_GEN_URL: https://cloud-java-bot:${{ secrets.CLOUD_JAVA_BOT_TOKEN }}@github.com/googleapis/googleapis-gen.git API_SHORTNAME: ${{ github.event.inputs.api_shortname }} NAME_PRETTY: ${{ github.event.inputs.name_pretty }} PROTO_PATH: ${{ github.event.inputs.proto_path }} @@ -143,5 +143,5 @@ jobs: USERNAME: ${{ github.actor }} API_SHORTNAME: ${{ github.event.inputs.api_shortname }} GENERATION_ARGUMENTS: ${{ steps.generation.outputs.new_library_args }} - GH_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} + GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} From 4c2aac62542c9b25ca968c22fc74505af5c264d7 Mon Sep 17 00:00:00 2001 From: diegomarquezp Date: Wed, 17 Jan 2024 21:46:44 +0000 Subject: [PATCH 2/4] split title and description of commit/pr --- .github/workflows/generate_new_client.yaml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/generate_new_client.yaml b/.github/workflows/generate_new_client.yaml index 7c6892611dc2..a7a5c4390efb 100644 --- a/.github/workflows/generate_new_client.yaml +++ b/.github/workflows/generate_new_client.yaml @@ -123,22 +123,21 @@ jobs: branch_name="new-library/${{ github.event.inputs.api_shortname }}-${random_id}" git checkout -b "${branch_name}" git add --all - git commit -m "feat: [${API_SHORTNAME}] new module for ${API_SHORTNAME} - + commit_message="feat: [${API_SHORTNAME}] new module for ${API_SHORTNAME}" + git commit -m "${commit_message}" + git remote add monorepo https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git + git fetch -q --unshallow monorepo + git push -f monorepo "${branch_name}" - Generated with https://github.com/googleapis/google-cloud-java/actions/workflows/generate_new_client.yaml + # create PR + pr_body="Generated with https://github.com/googleapis/google-cloud-java/actions/workflows/generate_new_client.yaml Command used: \`\`\` python generation/new_client/new-client.py generate ${GENERATION_ARGUMENTS} \`\`\`" - git remote add monorepo https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git - git fetch -q --unshallow monorepo - git push -f monorepo "${branch_name}" - - # create PR - gh pr create --fill --head "${branch_name}" + gh pr create --title "${commit_message}" --body "${pr_body}" --head "${branch_name}" env: USERNAME: ${{ github.actor }} API_SHORTNAME: ${{ github.event.inputs.api_shortname }} From 7ffd10f3361f9888628b9231b768004bf54c1d9b Mon Sep 17 00:00:00 2001 From: diegomarquezp Date: Thu, 18 Jan 2024 00:27:12 +0000 Subject: [PATCH 3/4] try github.token for authoring the PR --- .github/workflows/generate_new_client.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate_new_client.yaml b/.github/workflows/generate_new_client.yaml index a7a5c4390efb..5ec4588f9152 100644 --- a/.github/workflows/generate_new_client.yaml +++ b/.github/workflows/generate_new_client.yaml @@ -137,10 +137,10 @@ jobs: \`\`\` python generation/new_client/new-client.py generate ${GENERATION_ARGUMENTS} \`\`\`" - gh pr create --title "${commit_message}" --body "${pr_body}" --head "${branch_name}" + gh pr create --title "${commit_message}" --label "owlbot:run" --head "${branch_name}" --body "${pr_body}" env: USERNAME: ${{ github.actor }} API_SHORTNAME: ${{ github.event.inputs.api_shortname }} GENERATION_ARGUMENTS: ${{ steps.generation.outputs.new_library_args }} - GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} + GH_TOKEN: ${{ github.token }} From 0332ee667cf60a16a8a138c348feac0e435db7d7 Mon Sep 17 00:00:00 2001 From: diegomarquezp Date: Thu, 18 Jan 2024 00:42:51 +0000 Subject: [PATCH 4/4] include calling user in pr description, restore cloud java bot token --- .github/workflows/generate_new_client.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate_new_client.yaml b/.github/workflows/generate_new_client.yaml index 5ec4588f9152..d263b7b5a90e 100644 --- a/.github/workflows/generate_new_client.yaml +++ b/.github/workflows/generate_new_client.yaml @@ -130,7 +130,7 @@ jobs: git push -f monorepo "${branch_name}" # create PR - pr_body="Generated with https://github.com/googleapis/google-cloud-java/actions/workflows/generate_new_client.yaml + pr_body="Generated by @${USERNAME} via [generate_new_client.yaml](https://github.com/googleapis/google-cloud-java/actions/workflows/generate_new_client.yaml) Command used: @@ -142,5 +142,5 @@ jobs: USERNAME: ${{ github.actor }} API_SHORTNAME: ${{ github.event.inputs.api_shortname }} GENERATION_ARGUMENTS: ${{ steps.generation.outputs.new_library_args }} - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}