forked from googleapis/google-cloud-java
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(java): auto-approve README regeneration (googleapis#274)
This PR was generated using Autosynth. 🌈 Synth log will be available here: https://source.cloud.google.com/results/invocations/a86e4a21-dc46-4303-944d-7e61add32cbb/targets - [ ] To automatically regenerate this PR, check this box. Source-Link: googleapis/synthtool@7c53709
- Loading branch information
1 parent
b530956
commit b20a7ae
Showing
2 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
java-resourcemanager/.github/workflows/approve-readme.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
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'] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters