-
Notifications
You must be signed in to change notification settings - Fork 865
79 lines (78 loc) · 2.96 KB
/
release-please.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
on:
schedule:
- cron: '49 8 * * 1'
workflow_dispatch:
name: release-please
jobs:
release-please:
env:
ENABLE_AUTO_APPROVE: ${{ secrets.ENABLE_AUTO_APPROVE }}
ENABLE_RELEASE_PLEASE: ${{ secrets.ENABLE_RELEASE_PLEASE }}
runs-on: ubuntu-latest
steps:
- name: ReleasePlease
if: ${{ env.ENABLE_RELEASE_PLEASE }}
uses: GoogleCloudPlatform/release-please-action@v2.5.7
with:
command: release-pr
token: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
fork: true
release-type: ruby
package-name: google-api-ruby-client
version-file: lib/google/apis/version.rb
monorepo-tags: true
bump-minor-pre-major: true
- name: AutoApprove
if: ${{ always() && env.ENABLE_RELEASE_PLEASE }}
uses: actions/github-script@v2
with:
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
script: |
let found = false;
for (let tries = 3; tries > 0; tries--) {
await new Promise(r => setTimeout(r, 2000));
const prs = await github.pulls.list({
owner: 'googleapis',
repo: 'google-api-ruby-client',
state: 'open',
sort: 'created',
direction: 'desc',
per_page: 10
});
prs.data.forEach(function(pr) {
if (found || pr.user.login != "yoshi-code-bot" || !pr.title.startsWith("Release ")) {
return;
}
core.info("AutoApprove: Found release PR " + pr.number);
if (process.env.ENABLE_AUTO_APPROVE) {
core.info("ENABLE_AUTO_APPROVE is set; labeling and approving");
github.pulls.createReview({
owner: 'googleapis',
repo: 'google-api-ruby-client',
body: "AutoApprove: Rubber stamped release!",
pull_number: pr.number,
event: "APPROVE"
});
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.");
}