# yamllint disable rule:line-length # shellcheck disable=SC2043 --- name: Automerge PRs on: issue_comment: types: - created jobs: automerge: runs-on: ubuntu-latest steps: - name: Check if comment contains "/automerge" id: check_comment uses: actions/github-script@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const comment = context.payload.comment.body; return { automerge: comment.includes('/automerge') }; - name: Merge PR if: steps.check_comment.outputs.automerge uses: actions/github-script@v5 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const prNumber = context.payload.issue.number; const owner = context.repo.owner; const repo = context.repo.repo; await github.pulls.merge({ owner, repo, pull_number: prNumber, merge_method: 'merge' }); console.log(`PR #${prNumber} merged successfully.`);