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

Commit

Permalink
build(java): auto-approve README regeneration (#315)
Browse files Browse the repository at this point in the history
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/c5774b2c-8184-4adf-a8e1-dd200c62b13a/targets

- [ ] To automatically regenerate this PR, check this box.

Source-Link: googleapis/synthtool@7c53709
  • Loading branch information
yoshi-automation committed Oct 16, 2020
1 parent 64730ea commit 636f3ca
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/approve-readme.yaml
@@ -0,0 +1,54 @@
on:
pull_request:
name: auto-merge-readme
jobs:
approve:
runs-on: ubuntu-latest
if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme'
steps:
- uses: actions/github-script@v3.0.0
with:
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
script: |
// only approve PRs from yoshi-automation
if (context.payload.pull_request.user.login !== "yoshi-automation") {
return;
}
// only approve PRs like "chore: release <release version>"
if (!context.payload.pull_request.title === "chore: regenerate README") {
return;
}
// only approve PRs with README.md and synth.metadata changes
const files = new Set(
(
await github.paginate(
github.pulls.listFiles.endpoint({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
})
)
).map(file => file.filename)
);
if (files.size != 2 || !files.has("README.md") || !files.has(".github/readme/synth.metadata/synth.metadata")) {
return;
}
// approve README regeneration PR
await github.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Rubber stamped PR!',
pull_number: context.payload.pull_request.number,
event: 'APPROVE'
});
// attach automerge label
await github.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
labels: ['automerge']
});
5 changes: 3 additions & 2 deletions synth.metadata
Expand Up @@ -4,7 +4,7 @@
"git": {
"name": ".",
"remote": "https://github.com/googleapis/java-speech.git",
"sha": "1f110623b5a338a0b2964360a834cd020657e207"
"sha": "64730ea495287984baf7651f0d4589cf37b33db9"
}
},
{
Expand All @@ -27,7 +27,7 @@
"git": {
"name": "synthtool",
"remote": "https://github.com/googleapis/synthtool.git",
"sha": "27e0e916cbfdb3d5ff6639b686cc04f78a0b0386"
"sha": "7c5370937dd9ba9dcf9cd7d2af880a58b389b4f1"
}
}
],
Expand Down Expand Up @@ -60,6 +60,7 @@
".github/readme/synth.py",
".github/release-please.yml",
".github/trusted-contribution.yml",
".github/workflows/approve-readme.yaml",
".github/workflows/auto-release.yaml",
".github/workflows/ci.yaml",
".github/workflows/formatting.yaml",
Expand Down

0 comments on commit 636f3ca

Please sign in to comment.