Skip to content

Commit 7c6bfef

Browse files
authored
chore: setup reusable workflow (googleapis#11117)
* chore: setup reusable workflow * update workflow * update workflow * create a reusable workflow * create a calling workflow * change dir * remove workflow version * change job name * debug * update googleapis commit * add inputs * restore googleapis commit * update googleapis commit * update googleapis commit * restore googleapis commit * remove debug setting * start the workflow whenever there's a change * add a composite action * checkout early * change path * remove checkout depth * checkout base ref * use git to checkout * use git to checkout * use composite action * change env * change seq * use cp * use composite action * add ref * use reusable workflow * use reusable workflow * change name * remove runs-on * restore * change action path * remove generation step * add inputs * add inputs * add prerequisite as the first step * add a separate job * add a step * change version * update renovate
1 parent 37a10d2 commit 7c6bfef

File tree

3 files changed

+19
-144
lines changed

3 files changed

+19
-144
lines changed

.github/scripts/hermetic_library_generation.sh

Lines changed: 0 additions & 126 deletions
This file was deleted.

.github/workflows/hermetic_library_generation.yaml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,22 @@ jobs:
2424
library_generation:
2525
runs-on: ubuntu-latest
2626
steps:
27-
- uses: actions/checkout@v4
28-
with:
29-
fetch-depth: 0
30-
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
31-
- name: Generate changed libraries
32-
shell: bash
27+
- name: Determine whether the pull request comes from a fork
3328
run: |
34-
set -x
3529
if [[ "${GITHUB_REPOSITORY}" != "${REPO_FULL_NAME}" ]]; then
3630
echo "This PR comes from a fork. Skip library generation."
37-
exit 0
31+
echo "SHOULD_RUN=false" >> $GITHUB_ENV
32+
else
33+
echo "SHOULD_RUN=true" >> $GITHUB_ENV
3834
fi
39-
[ -z "$(git config user.email)" ] && git config --global user.email "cloud-java-bot@google.com"
40-
[ -z "$(git config user.name)" ] && git config --global user.name "cloud-java-bot"
41-
bash .github/scripts/hermetic_library_generation.sh \
42-
--target_branch "${base_ref}" \
43-
--current_branch "${head_ref}"
44-
env:
35+
- uses: actions/checkout@v4
36+
if: env.SHOULD_RUN == 'true'
37+
with:
38+
fetch-depth: 0
39+
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
40+
- uses: googleapis/sdk-platform-java/.github/scripts@v2.46.0
41+
if: env.SHOULD_RUN == 'true'
42+
with:
4543
base_ref: ${{ github.base_ref }}
4644
head_ref: ${{ github.head_ref }}
47-
GH_TOKEN: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}
45+
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}

renovate.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"owl-bot-postprocessor/synthtool/gcp/templates/java-library/.kokoro/presubmit/graalvm-native*.cfg",
2727
".github/workflows/ci.yaml",
2828
".github/workflows/generated_files_sync.yaml",
29-
".github/workflows/unmanaged_dependency_check.yaml"
29+
".github/workflows/unmanaged_dependency_check.yaml",
30+
".github/workflows/hermetic_library_generation.yaml"
3031
],
3132
"regexManagers": [
3233
{
@@ -57,10 +58,12 @@
5758
{
5859
"fileMatch": [
5960
".github/workflows/ci.yaml",
60-
".github/workflows/generated_files_sync.yaml"
61+
".github/workflows/generated_files_sync.yaml",
62+
".github/workflows/hermetic_library_generation.yaml"
6163
],
6264
"matchStrings": [
63-
"library_generation_image_tag\\s*:\\s*(?<currentValue>.*?)\\n"
65+
"library_generation_image_tag\\s*:\\s*(?<currentValue>.*?)\\n",
66+
"uses: googleapis/sdk-platform-java/.github/scripts@v(?<currentValue>.+?)\\n"
6467
],
6568
"depNameTemplate": "com.google.api:gapic-generator-java",
6669
"datasourceTemplate": "maven"

0 commit comments

Comments
 (0)