Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.

Commit 098ab1f

Browse files
chore: regenerate templates
* chore(ci): skip autorelease workflow on non-release PRs Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com> Source-Date: Thu Sep 24 16:57:32 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: 95dbe1bee3c7f7e52ddb24a54c37080620e0d1a2 Source-Link: googleapis/synthtool@95dbe1b * chore(ci): verify autorelease release PR content has changes Source-Author: Stephanie Wang <stephaniewang526@users.noreply.github.com> Source-Date: Thu Sep 24 18:06:14 2020 -0400 Source-Repo: googleapis/synthtool Source-Sha: da29da32b3a988457b49ae290112b74f14b713cc Source-Link: googleapis/synthtool@da29da3 * chore(java): use separate autosynth job for README Split java README generation into a separate, per-repo continuous job running from Kokoro. We now generate a new job that runs on commits to the primary branch that strictly manages the README.md. This should prevent us from seeing the contextless autosynth PRs which are caused by non-proto/template upstream changes. Source-Author: Jeff Ching <chingor@google.com> Source-Date: Tue Sep 29 15:48:03 2020 -0700 Source-Repo: googleapis/synthtool Source-Sha: e6168630be3e31eede633ba2c6f1cd64248dec1c Source-Link: googleapis/synthtool@e616863
1 parent 9ca3199 commit 098ab1f

File tree

5 files changed

+134
-2
lines changed

5 files changed

+134
-2
lines changed

β€Ž.github/readme/synth.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""This script is used to synthesize generated the README for this library."""
16+
17+
from synthtool.languages import java
18+
19+
java.custom_templates(["java_library/README.md"])

β€Ž.github/workflows/auto-release.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ name: auto-release
44
jobs:
55
approve:
66
runs-on: ubuntu-latest
7+
if: contains(github.head_ref, 'release-v')
78
steps:
89
- uses: actions/github-script@v3.0.0
910
with:
@@ -20,6 +21,24 @@ jobs:
2021
return;
2122
}
2223
24+
// only approve PRs with pom.xml and versions.txt changes
25+
const filesPromise = github.pulls.listFiles.endpoint({
26+
owner: context.repo.owner,
27+
repo: context.repo.repo,
28+
pull_number: context.payload.pull_request.number,
29+
});
30+
const changed_files = await github.paginate(filesPromise)
31+
32+
if ( changed_files.length < 1 ) {
33+
console.log( "Not proceeding since PR is empty!" )
34+
return;
35+
}
36+
37+
if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) {
38+
console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" )
39+
return;
40+
}
41+
2342
// trigger auto-release when
2443
// 1) it is a SNAPSHOT release (auto-generated post regular release)
2544
// 2) there are dependency updates only

β€Ž.kokoro/continuous/readme.cfg

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Copyright 2020 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Format: //devtools/kokoro/config/proto/build.proto
16+
17+
env_vars: {
18+
key: "TRAMPOLINE_IMAGE"
19+
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
20+
}
21+
22+
env_vars: {
23+
key: "TRAMPOLINE_BUILD_FILE"
24+
value: "github/java-iam/.kokoro/readme.sh"
25+
}
26+
27+
# Build logs will be here
28+
action {
29+
define_artifacts {
30+
regex: "**/*sponge_log.xml"
31+
regex: "**/*sponge_log.log"
32+
}
33+
}
34+
35+
# The github token is stored here.
36+
before_action {
37+
fetch_keystore {
38+
keystore_resource {
39+
keystore_config_id: 73713
40+
keyname: "yoshi-automation-github-key"
41+
# TODO(theacodes): remove this after secrets have globally propagated
42+
backend_type: FASTCONFIGPUSH
43+
}
44+
}
45+
}
46+
47+
# Common env vars for all repositories and builds.
48+
env_vars: {
49+
key: "GITHUB_USER"
50+
value: "yoshi-automation"
51+
}
52+
env_vars: {
53+
key: "GITHUB_EMAIL"
54+
value: "yoshi-automation@google.com"
55+
}

β€Ž.kokoro/readme.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -eo pipefail
17+
18+
cd ${KOKORO_ARTIFACTS_DIR}/github/java-iam
19+
20+
# Disable buffering, so that the logs stream through.
21+
export PYTHONUNBUFFERED=1
22+
23+
# Kokoro exposes this as a file, but the scripts expect just a plain variable.
24+
export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key)
25+
26+
# Setup git credentials
27+
echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials
28+
git config --global credential.helper 'store --file ~/.git-credentials'
29+
30+
python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool
31+
python3.6 -m autosynth.synth \
32+
--repository=googleapis/java-iam \
33+
--synth-file-name=.github/readme/synth.py \
34+
--metadata-path=.github/readme/synth.metadata \
35+
--pr-title="chore: regenerate README" \
36+
--branch-suffix="readme"

β€Žsynth.metadata

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"git": {
55
"name": ".",
66
"remote": "https://github.com/googleapis/java-iam.git",
7-
"sha": "1a7b7748bf19ad1220e25c3780d263c48befaa04"
7+
"sha": "9ca319948ff7e9235848439d669462a3c71a1466"
88
}
99
},
1010
{
@@ -19,7 +19,7 @@
1919
"git": {
2020
"name": "synthtool",
2121
"remote": "https://github.com/googleapis/synthtool.git",
22-
"sha": "916c10e8581804df2b48a0f0457d848f3faa582e"
22+
"sha": "e6168630be3e31eede633ba2c6f1cd64248dec1c"
2323
}
2424
}
2525
],
@@ -29,6 +29,7 @@
2929
".github/ISSUE_TEMPLATE/feature_request.md",
3030
".github/ISSUE_TEMPLATE/support_request.md",
3131
".github/PULL_REQUEST_TEMPLATE.md",
32+
".github/readme/synth.py",
3233
".github/release-please.yml",
3334
".github/trusted-contribution.yml",
3435
".github/workflows/auto-release.yaml",
@@ -40,6 +41,7 @@
4041
".kokoro/common.sh",
4142
".kokoro/continuous/common.cfg",
4243
".kokoro/continuous/java8.cfg",
44+
".kokoro/continuous/readme.cfg",
4345
".kokoro/dependencies.sh",
4446
".kokoro/linkage-monitor.sh",
4547
".kokoro/nightly/common.cfg",
@@ -63,6 +65,7 @@
6365
".kokoro/presubmit/linkage-monitor.cfg",
6466
".kokoro/presubmit/lint.cfg",
6567
".kokoro/presubmit/samples.cfg",
68+
".kokoro/readme.sh",
6669
".kokoro/release/bump_snapshot.cfg",
6770
".kokoro/release/common.cfg",
6871
".kokoro/release/common.sh",

0 commit comments

Comments
 (0)