google-api-ruby-client/.github/workflows/release-please.yml

74 lines
2.6 KiB
YAML
Raw Normal View History

2020-10-28 18:10:51 +00:00
on:
schedule:
- cron: '49 8 * * 1'
2020-10-28 18:10:51 +00:00
workflow_dispatch:
name: release-please
jobs:
release-please:
2020-10-30 20:46:03 +00:00
env:
ENABLE_AUTO_APPROVE: ${{ secrets.ENABLE_AUTO_APPROVE }}
2020-10-28 18:10:51 +00:00
runs-on: ubuntu-latest
steps:
2020-10-30 20:46:03 +00:00
- name: ReleasePlease
uses: GoogleCloudPlatform/release-please-action@v2.5.7
2020-10-28 18:10:51 +00:00
with:
2020-10-29 22:51:04 +00:00
command: release-pr
2020-10-30 20:46:03 +00:00
token: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
2020-10-30 00:46:03 +00:00
fork: true
2020-10-28 18:10:51 +00:00
release-type: ruby
package-name: google-api-ruby-client
version-file: lib/google/apis/version.rb
monorepo-tags: true
bump-minor-pre-major: true
2020-10-30 20:46:03 +00:00
- name: AutoApprove
if: ${{ always() }}
uses: actions/github-script@v2
with:
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
script: |
const prs = await github.pulls.list({
owner: 'googleapis',
repo: 'google-api-ruby-client',
state: 'open',
sort: 'created',
direction: 'desc',
per_page: 10
});
var found = false;
2020-10-30 20:52:13 +00:00
prs.data.forEach(function(pr) {
2020-10-30 20:46:03 +00:00
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");
2020-10-30 20:49:52 +00:00
github.pulls.createReview({
2020-10-30 20:46:03 +00:00
owner: 'googleapis',
repo: 'google-api-ruby-client',
body: "AutoApprove: Rubber stamped release!",
pull_number: pr.number,
event: "APPROVE"
});
2020-10-30 20:49:52 +00:00
github.issues.addLabels({
2020-10-30 20:46:03 +00:00
owner: 'googleapis',
repo: 'google-api-ruby-client',
issue_number: pr.number,
labels: ["autorelease: pending", "automerge", "kokoro:force-run"]
2020-10-30 20:46:03 +00:00
});
} else {
core.info("ENABLE_AUTO_APPROVE is not set; labeling release only");
2020-10-30 20:49:52 +00:00
github.issues.addLabels({
2020-10-30 20:46:03 +00:00
owner: 'googleapis',
repo: 'google-api-ruby-client',
issue_number: pr.number,
labels: ["autorelease: pending", "kokoro:force-run"]
2020-10-30 20:46:03 +00:00
});
}
core.info("AutoApprove: complete!");
found = true;
});
if (!found) {
core.setFailed("Unable to find release PR.");
}