Skip to content

Commit

Permalink
fix: merge dependabot and nx worklfow into one (#271)
Browse files Browse the repository at this point in the history
* fix: rename auto-merge-dependabot-pr.yml to auto-merge-dependabot-nx-pr.yml

merge workflows into one

* fix: delete nx workflow because now merge into one workflow

* fix: change name

* fix: use squash instead of just merge
  • Loading branch information
KimFFVII authored Sep 6, 2024
1 parent 0c334a0 commit 4249af8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -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-')
Expand All @@ -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}}
28 changes: 0 additions & 28 deletions .github/workflows/auto-merge-dependabot-pr.yml

This file was deleted.

0 comments on commit 4249af8

Please sign in to comment.