Skip to content

Commit

Permalink
ok
Browse files Browse the repository at this point in the history
  • Loading branch information
hughcrt committed May 12, 2024
1 parent 7eb9806 commit 72dadc5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/auto-approve-pull-request.yml
Original file line number Diff line number Diff line change
@@ -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 }}
15 changes: 1 addition & 14 deletions .github/workflows/auto-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""

0 comments on commit 72dadc5

Please sign in to comment.