Skip to content

automerge

automerge #1423

Workflow file for this run

---
name: automerge
on:
workflow_run:
workflows:
- lint
types:
- completed
jobs:
automerge:
runs-on: ubuntu-latest
if: |
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: "Merge PR"
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.workflow_run.pull_requests[0].number,
});
if (!pr.data.title.startsWith('chore(deps-dev)')) {
console.log('Not Merged 🚫');
console.log(`Title === '${pr.data.title}'`);
} else if (pr.data.user.login !== 'dependabot[bot]') {
console.log('Not Merged 🚫');
console.log(`User === '${pr.data.user.login}'`);
} else {
await github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.workflow_run.pull_requests[0].number,
});
console.log('Merged 🎉');
}