diff --git a/.github/workflows/auto_merge.yml b/.github/workflows/auto_merge.yml index 7a52e13..3c5e81c 100644 --- a/.github/workflows/auto_merge.yml +++ b/.github/workflows/auto_merge.yml @@ -1,12 +1,12 @@ -name: Merge to Base +name: Auto Merge Pull Request on: push: branches: - - main # Adjust this according to your main branch name in your forked repository + - main jobs: - merge_to_base: + auto_merge: runs-on: ubuntu-latest steps: @@ -22,8 +22,20 @@ jobs: uses: peter-evans/create-pull-request@v3 with: token: ${{ secrets.PAT_TOKEN }} - branch: master # Adjust this according to your main branch name in your forked repository - base: main # Adjust this according to your main branch name in the base repository + branch: master + base: main title: Automatically generated PR body: | This pull request was automatically generated by a GitHub Action. + + - name: Get Pull Request Number + id: pr_number + run: echo "::set-output name=number::$(jq -r '.number' $GITHUB_EVENT_PATH)" + + - name: Merge Pull Request + run: | + PR_NUMBER="${{ steps.pr_number.outputs.number }}" + curl -X PUT \ + -H "Authorization: token ${{ secrets.PAT_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/Adarsha16/CodeRoom/pulls/$PR_NUMBER/merge"