From 72dadc5f574c9a278be9e9c22d6d887936c94a2b Mon Sep 17 00:00:00 2001 From: hughcrt Date: Sun, 12 May 2024 18:40:28 -0300 Subject: [PATCH] ok --- .github/workflows/auto-approve-pull-request.yml | 17 +++++++++++++++++ .github/workflows/auto-pull-request.yml | 15 +-------------- 2 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/auto-approve-pull-request.yml diff --git a/.github/workflows/auto-approve-pull-request.yml b/.github/workflows/auto-approve-pull-request.yml new file mode 100644 index 00000000..e5f76516 --- /dev/null +++ b/.github/workflows/auto-approve-pull-request.yml @@ -0,0 +1,17 @@ +name: Auto-approve PRs + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + auto-approve: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Auto-approve PR + uses: hmarr/auto-approve-action@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/auto-pull-request.yml b/.github/workflows/auto-pull-request.yml index bda87153..b0cb9b89 100644 --- a/.github/workflows/auto-pull-request.yml +++ b/.github/workflows/auto-pull-request.yml @@ -12,21 +12,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Create Pull Request run: | prefix=$(echo ${{ github.ref }}| cut -d '/' -f 3) branch_name=$(echo ${{ github.ref }} | cut -d '/' -f 4- | tr '-' ' ') - PR_URL=$(GH_TOKEN=${{ secrets.GH_TOKEN }} gh pr create --title "${prefix}: ${branch_name}" --body "" --json url --jq '.url') - - - name: Extract PR Number - id: extract-pr-number - run: echo "PR_NUMBER=$(echo $PR_URL | grep -o -E '[0-9]+$')" >> $GITHUB_ENV - - - name: Approve Pull Request - run: | - curl -s -X POST \ - -H "Authorization: token ${{ secrets.GH_TOKEN }}" \ - -H "Accept: application/vnd.github.v3+json" \ - -d '{"body":"Auto-approving the pull request","event":"APPROVE"}' \ - https://api.github.com/repos/${{ github.repository }}/pulls/${{ env.PR_NUMBER }}/reviews + GH_TOKEN=${{ secrets.GH_TOKEN }} gh pr create --title "${prefix}: ${branch_name}" --body ""