Skip to content

Commit

Permalink
chore: add auto-approve workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
xiehan authored Dec 4, 2023
1 parent 5fa7efe commit 5980d8e
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/auto-approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: auto-approve
on:
pull_request_target:
types:
- opened
- labeled
- ready_for_review
- reopened
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
approve:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
if: contains(github.event.pull_request.labels.*.name, 'auto-approve') && github.event.pull_request.draft == false
steps:
- name: Checkout PR
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Auto-approve PRs by other users as team-tf-cdk
if: github.event.pull_request.user.login != 'team-tf-cdk' && (contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) || github.actor == 'dependabot[bot]')
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }} # NOTE: Replace this with the name of your token associated with the team-tf-cdk user
run: gh pr review ${{ github.event.pull_request.number }} --approve
- name: Auto-approve PRs by team-tf-cdk as github-actions[bot]
if: github.event.pull_request.user.login == 'team-tf-cdk'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token does not need to be replaced
run: gh pr review ${{ github.event.pull_request.number }} --approve

0 comments on commit 5980d8e

Please sign in to comment.