From aca3984ae9cbd1e4f898a5d03cc3a11b401147da Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Mon, 22 Aug 2022 12:42:29 +0000 Subject: [PATCH] CI: automatically approve a PR if has `auto-approve` label --- src/ci/github-actions/ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index a6bdd9f3186b1..8cadd3044f676 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -770,3 +770,19 @@ jobs: needs: [auto] if: "!success() && github.event_name == 'push' && github.ref == 'refs/heads/auto' && github.repository == 'rust-lang-ci/rust'" <<: *base-failure-job + ci-auto-approve: + runs-on: ubuntu-latest + name: "automatically approve if configured" + needs: [pr] + if: ${{ always() && !cancelled() && needs.build.result == 'success' && github.event.pull_request.labels.contains('auto-approve') }} + steps: + - uses: actions/github-script@v5 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '@bors r=' + context.event.pull_request.assignee.login + })