diff --git a/.github/workflows/auto-rebase-and-merge-nx-pr.yml b/.github/workflows/auto-merge-dependabot-nx-pr.yml similarity index 50% rename from .github/workflows/auto-rebase-and-merge-nx-pr.yml rename to .github/workflows/auto-merge-dependabot-nx-pr.yml index ee99cb6..de7b512 100644 --- a/.github/workflows/auto-rebase-and-merge-nx-pr.yml +++ b/.github/workflows/auto-merge-dependabot-nx-pr.yml @@ -1,8 +1,34 @@ -name: Automatic rebase and merge NX PRs +name: Auto merge dependabot and NX PRs on: pull_request_target: jobs: - rebase: + auto-merge-dependabot-pr: + if: >- + github.event.pull_request.user.login == 'dependabot[bot]' && + ( + startsWith(github.head_ref, 'dependabot/npm_and_yarn/angular-') || + startsWith(github.head_ref, 'dependabot/npm_and_yarn/onecx-') || + startsWith(github.event.pull_request.title, 'chore(deps-dev)') + ) + runs-on: ubuntu-latest + steps: + - name: Auto Approve + uses: actions/github-script@v4 + with: + script: | + const result = await github.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number, + event: "APPROVE" + }) + - name: Enable auto-merge for Dependabot PRs + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + + rebase-merge-nx-pr: name: Rebase and merge runs-on: ubuntu-latest if: github.event.pull_request.user.login == 'tkit-dev' && startsWith(github.head_ref, 'migrate-nx-to-') @@ -27,7 +53,7 @@ jobs: event: "APPROVE" }) - name: Enable auto-merge for NX PRs - run: gh pr merge --auto --merge "$PR_URL" + run: gh pr merge --auto --squash "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/auto-merge-dependabot-pr.yml b/.github/workflows/auto-merge-dependabot-pr.yml deleted file mode 100644 index c5e5ae4..0000000 --- a/.github/workflows/auto-merge-dependabot-pr.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Auto merge dependabot Angular and Onecx PRs -on: - pull_request_target: -jobs: - auto-merge: - if: >- - github.event.pull_request.user.login == 'dependabot[bot]' && - ( - startsWith(github.head_ref, 'dependabot/npm_and_yarn/angular-') || - startsWith(github.head_ref, 'dependabot/npm_and_yarn/onecx-') - ) - runs-on: ubuntu-latest - steps: - - name: Auto Approve - uses: actions/github-script@v4 - with: - script: | - const result = await github.pulls.createReview({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.issue.number, - event: "APPROVE" - }) - - name: Enable auto-merge for Dependabot PRs - run: gh pr merge --auto --squash "$PR_URL" - env: - PR_URL: ${{github.event.pull_request.html_url}} - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}