Automatic Merge to Respository

Hello,

I am new to using GitHub actions and I create a workflow for Node.js, and I have been looking around but I haven’t been able to find out how to set-up my .yaml so that after running all the tests if they pass it automatically merges the pull-requests back to the master repository. Can somebody help me please?

You could use something like this action:

With a step condition (after your tests):
if: success()

@StephenP-Hung,

You can reference to the following demo to configure your workflow:

on: pull_request

jobs:
  build:
    . . .
  test:
    needs: [build]
    . . .

  merge_pr:
    needs: [build, test]
    runs-on: ubuntu-latest
    steps:
      - name: Auto-merge PR
        uses: <an action to auto-merge PR>
# In this step you can execute an action to auto-merge the PR.
# I find some related actions from the GitHub Marketplace, 
# see "https://github.com/marketplace?query=merge+pull+request".
# You can use one of them in this step to auto-merge the PR.