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

Commit

Permalink
chore: regenerate templates (#135)
Browse files Browse the repository at this point in the history
* build(java): use yoshi-approver token for auto-approve

Source-Author: Jeff Ching <[email protected]>
Source-Date: Wed Sep 23 12:46:45 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 916c10e8581804df2b48a0f0457d848f3faa582e
Source-Link: googleapis/synthtool@916c10e

* chore(ci): skip autorelease workflow on non-release PRs

Source-Author: Stephanie Wang <[email protected]>
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 <[email protected]>
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 <[email protected]>
Source-Date: Tue Sep 29 15:48:03 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: e6168630be3e31eede633ba2c6f1cd64248dec1c
Source-Link: googleapis/synthtool@e616863
  • Loading branch information
yoshi-automation authored Oct 30, 2020
1 parent 0bbe235 commit 7ddfa2b
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 5 deletions.
19 changes: 19 additions & 0 deletions .github/readme/synth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""This script is used to synthesize generated the README for this library."""

from synthtool.languages import java

java.custom_templates(["java_library/README.md"])
23 changes: 21 additions & 2 deletions .github/workflows/auto-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ name: auto-release
jobs:
approve:
runs-on: ubuntu-latest
if: contains(github.head_ref, 'release-v')
steps:
- uses: actions/[email protected]
with:
github-token: ${{secrets.GITHUB_TOKEN}}
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
debug: true
script: |
// only approve PRs from release-please[bot]
Expand All @@ -20,6 +21,24 @@ jobs:
return;
}
// only approve PRs with pom.xml and versions.txt changes
const filesPromise = github.pulls.listFiles.endpoint({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
const changed_files = await github.paginate(filesPromise)
if ( changed_files.length < 1 ) {
console.log( "Not proceeding since PR is empty!" )
return;
}
if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) {
console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" )
return;
}
// trigger auto-release when
// 1) it is a SNAPSHOT release (auto-generated post regular release)
// 2) there are dependency updates only
Expand Down Expand Up @@ -66,4 +85,4 @@ jobs:
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: ['kokoro:force-run', 'automerge']
});
});
55 changes: 55 additions & 0 deletions .kokoro/continuous/readme.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Format: //devtools/kokoro/config/proto/build.proto

env_vars: {
key: "TRAMPOLINE_IMAGE"
value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
}

env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/java-mediatranslation/.kokoro/readme.sh"
}

# Build logs will be here
action {
define_artifacts {
regex: "**/*sponge_log.xml"
regex: "**/*sponge_log.log"
}
}

# The github token is stored here.
before_action {
fetch_keystore {
keystore_resource {
keystore_config_id: 73713
keyname: "yoshi-automation-github-key"
# TODO(theacodes): remove this after secrets have globally propagated
backend_type: FASTCONFIGPUSH
}
}
}

# Common env vars for all repositories and builds.
env_vars: {
key: "GITHUB_USER"
value: "yoshi-automation"
}
env_vars: {
key: "GITHUB_EMAIL"
value: "[email protected]"
}
36 changes: 36 additions & 0 deletions .kokoro/readme.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -eo pipefail

cd ${KOKORO_ARTIFACTS_DIR}/github/java-mediatranslation

# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1

# Kokoro exposes this as a file, but the scripts expect just a plain variable.
export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key)

# Setup git credentials
echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials
git config --global credential.helper 'store --file ~/.git-credentials'

python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool
python3.6 -m autosynth.synth \
--repository=googleapis/java-mediatranslation \
--synth-file-name=.github/readme/synth.py \
--metadata-path=.github/readme/synth.metadata \
--pr-title="chore: regenerate README" \
--branch-suffix="readme"
8 changes: 5 additions & 3 deletions synth.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-mediatranslation.git",
"sha": "32bf8385a1df637e03c7a30959663298fdfb23f6"
"sha": "d5b38890565a89f1594bba606db04cfade229c77"
}
},
{
Expand All @@ -19,7 +19,7 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "80003a3de2d8a75f5b47cb2e77e018f7f0f776cc"
"sha": "e6168630be3e31eede633ba2c6f1cd64248dec1c"
}
}
],
Expand All @@ -40,6 +40,7 @@
".github/ISSUE_TEMPLATE/feature_request.md",
".github/ISSUE_TEMPLATE/support_request.md",
".github/PULL_REQUEST_TEMPLATE.md",
".github/readme/synth.py",
".github/release-please.yml",
".github/trusted-contribution.yml",
".github/workflows/auto-release.yaml",
Expand All @@ -52,6 +53,7 @@
".kokoro/common.sh",
".kokoro/continuous/common.cfg",
".kokoro/continuous/java8.cfg",
".kokoro/continuous/readme.cfg",
".kokoro/dependencies.sh",
".kokoro/linkage-monitor.sh",
".kokoro/nightly/common.cfg",
Expand All @@ -75,6 +77,7 @@
".kokoro/presubmit/linkage-monitor.cfg",
".kokoro/presubmit/lint.cfg",
".kokoro/presubmit/samples.cfg",
".kokoro/readme.sh",
".kokoro/release/bump_snapshot.cfg",
".kokoro/release/common.cfg",
".kokoro/release/common.sh",
Expand All @@ -92,7 +95,6 @@
"CODE_OF_CONDUCT.md",
"CONTRIBUTING.md",
"LICENSE",
"README.md",
"codecov.yaml",
"google-cloud-mediatranslation/src/main/java/com/google/cloud/mediatranslation/v1beta1/SpeechTranslationServiceClient.java",
"google-cloud-mediatranslation/src/main/java/com/google/cloud/mediatranslation/v1beta1/SpeechTranslationServiceSettings.java",
Expand Down

0 comments on commit 7ddfa2b

Please sign in to comment.