Skip to content

Commit

Permalink
chore: use CLOUD_JAVA_BOT_TOKEN in generate_new_client.yaml (#10234)
Browse files Browse the repository at this point in the history
* Use `CLOUD_JAVA_BOT_TOKEN` in generate_new_client.yaml

* split title and description of commit/pr

* try github.token for authoring the PR

* include calling user in pr description, restore cloud java bot token
  • Loading branch information
diegomarquezp authored Jan 18, 2024
1 parent f29c08f commit 1035c76
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions .github/workflows/generate_new_client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -123,25 +123,24 @@ 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 by @${USERNAME} via [generate_new_client.yaml](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}" --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.YOSHI_CODE_BOT_TOKEN }}
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}

0 comments on commit 1035c76

Please sign in to comment.