• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Googleapis Sync (Hermetic Build)
2on:
3  workflow_dispatch:
4
5jobs:
6  create-pull-request:
7    name: Create pull request for recent googleapis changes
8    runs-on: ubuntu-latest
9    steps:
10    - uses: actions/checkout@v3
11      with:
12        repository: 'googleapis/google-cloud-java'
13    - name: Setup workspace
14      run: |
15        mkdir -p "${WORKSPACE}"
16        git config user.email "yoshi-code-bot[bot]@users.noreply.github.com"
17        git config user.name "yoshi-code-bot"
18
19        git clone --quiet --branch "${BASE_BRANCH}" --depth 1 \
20            https://github.com/googleapis/google-cloud-java \
21            "${WORKSPACE}/google-cloud-java"
22        cd "${WORKSPACE}/google-cloud-java"
23        # This should match the branch name we push to remote in the following steps
24        git checkout -b monorepo_googleapis_change
25      env:
26        WORKSPACE: /tmp/googleapis-sync
27        BASE_BRANCH: main
28    - name: Propagate googleapis commits to google-cloud-java
29      run: |
30        .kokoro/sync_with_googleapis.sh
31      env:
32        WORKSPACE: /tmp/googleapis-sync
33        GOOGLE_CLOUD_JAVA_DIR: /tmp/googleapis-sync/google-cloud-java
34    - name: Push changes to remote repository
35      run: |
36        git remote add origin_with_auth \
37            https://${{ github.actor }}:${{ github.token }}@github.com/${{ github.repository }}.git
38        git push -f --set-upstream origin_with_auth monorepo_googleapis_change
39      working-directory: /tmp/googleapis-sync/google-cloud-java
40      env:
41        GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
42    - name: Create pull request
43      run: |
44        gh pr create --title='chore: googleapis change propagation via hermetic build' \
45            --body='googleapis change propagation via hermetic build' \
46            --base="${BASE_BRANCH}" \
47            --head=monorepo_googleapis_change
48      working-directory: /tmp/googleapis-sync/google-cloud-java
49      env:
50        GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
51        # Note for cutover to main: update this to main
52        BASE_BRANCH: main