on: schedule: - cron: '49 8 * * 1' workflow_dispatch: name: release-please jobs: release-please: if: secrets.ENABLE_RELEASE_PLEASE env: ENABLE_AUTO_APPROVE: ${{ secrets.ENABLE_AUTO_APPROVE }} runs-on: ubuntu-latest steps: - name: ReleasePlease 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() }} 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."); }