chore: Update release-please action to take advantage of upstream fixes (#1651)

This commit is contained in:
Daniel Azuma 2020-12-07 14:52:19 -08:00 committed by GitHub
parent 80e2fadffd
commit df748da840
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 45 deletions

View File

@ -12,8 +12,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: ReleasePlease - name: ReleasePlease
id: release-please
if: ${{ env.ENABLE_RELEASE_PLEASE }} if: ${{ env.ENABLE_RELEASE_PLEASE }}
uses: GoogleCloudPlatform/release-please-action@v2.5.7 uses: GoogleCloudPlatform/release-please-action@v2
with: with:
command: release-pr command: release-pr
token: ${{ secrets.YOSHI_CODE_BOT_TOKEN }} token: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
@ -24,56 +25,33 @@ jobs:
monorepo-tags: true monorepo-tags: true
bump-minor-pre-major: true bump-minor-pre-major: true
- name: AutoApprove - name: AutoApprove
if: ${{ always() && env.ENABLE_RELEASE_PLEASE }} id: auto-approve
if: ${{ steps.release-please.outputs.pr }}
uses: actions/github-script@v2 uses: actions/github-script@v2
with: with:
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
script: | script: |
let found = false; if (process.env.ENABLE_AUTO_APPROVE) {
for (let tries = 3; tries > 0; tries--) { core.info("ENABLE_AUTO_APPROVE is set; labeling and approving");
await new Promise(r => setTimeout(r, 2000)); github.pulls.createReview({
const prs = await github.pulls.list({
owner: 'googleapis', owner: 'googleapis',
repo: 'google-api-ruby-client', repo: 'google-api-ruby-client',
state: 'open', body: "AutoApprove: Rubber stamped release!",
sort: 'created', pull_number: ${{ steps.release-please.outputs.pr }},
direction: 'desc', event: "APPROVE"
per_page: 10
}); });
prs.data.forEach(function(pr) { github.issues.addLabels({
if (found || pr.user.login != "yoshi-code-bot" || !pr.title.startsWith("Release ")) { owner: 'googleapis',
return; repo: 'google-api-ruby-client',
} issue_number: ${{ steps.release-please.outputs.pr }},
core.info("AutoApprove: Found release PR " + pr.number); labels: ["autorelease: pending", "automerge", "kokoro:force-run"]
if (process.env.ENABLE_AUTO_APPROVE) { });
core.info("ENABLE_AUTO_APPROVE is set; labeling and approving"); } else {
github.pulls.createReview({ core.info("ENABLE_AUTO_APPROVE is not set; labeling release only");
owner: 'googleapis', github.issues.addLabels({
repo: 'google-api-ruby-client', owner: 'googleapis',
body: "AutoApprove: Rubber stamped release!", repo: 'google-api-ruby-client',
pull_number: pr.number, issue_number: ${{ steps.release-please.outputs.pr }},
event: "APPROVE" labels: ["autorelease: pending", "kokoro:force-run"]
});
github.issues.addLabels({
owner: 'googleapis',
repo: 'google-api-ruby-client',
issue_number: pr.number,
labels: ["autorelease: pending", "automerge", "kokoro:force-run"]
});
} else {
core.info("ENABLE_AUTO_APPROVE is not set; labeling release only");
github.issues.addLabels({
owner: 'googleapis',
repo: 'google-api-ruby-client',
issue_number: pr.number,
labels: ["autorelease: pending", "kokoro:force-run"]
});
}
core.info("AutoApprove: complete!");
found = true;
tries = 0;
}); });
} }
if (!found) {
core.setFailed("Unable to find release PR after 3 tries.");
}