diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 00000000..a799f990 --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,49 @@ +name: Auto Merge Snyk Bot PRs + +on: + pull_request: + types: + - opened + - synchronize + - reopened + +jobs: + automerge: + if: > + github.actor == 'snyk-io[bot]' && + github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Wait for all checks to pass + uses: actions/github-script@v6 + with: + script: | + const pr = context.payload.pull_request; + const checks = await github.checks.listForRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: pr.head.sha, + }); + if (checks.data.check_runs.some(check => check.conclusion !== 'success')) { + core.setFailed('Not all checks have passed.'); + } + + - name: Merge the pull request + uses: actions/github-script@v6 + with: + script: | + await github.pulls.merge({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + merge_method: 'squash', + }); \ No newline at end of file diff --git a/package.json b/package.json index c0687861..dc1b7a68 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "embla-carousel-react": "^8.5.2", "lucide-react": "^0.469.0", "motion": "^11.18.1", - "next": "^14.2.23", + "next": "^14.2.25", "next-themes": "^0.4.4", "react": "^18", "react-dom": "^18",