From a782b8de45459fec1eec884b0a621a2aec1fb24f Mon Sep 17 00:00:00 2001 From: Dev-Re2906 Date: Thu, 24 Jul 2025 10:14:01 +0330 Subject: [PATCH] Create dependabot-automerge.yml Signed-off-by: Dev-Re2906 --- .github/workflows/dependabot-automerge.yml | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/dependabot-automerge.yml diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml new file mode 100644 index 0000000..d9e1f7d --- /dev/null +++ b/.github/workflows/dependabot-automerge.yml @@ -0,0 +1,46 @@ +name: Dependabot Auto-merge + +on: + pull_request: + types: + - opened + - synchronize + - reopened + +permissions: + contents: write + pull-requests: write + +jobs: + test-and-merge: + if: github.actor == 'dependabot[bot]' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + # نصب Node.js برای اجرای تست (اگر پروژه Node.js باشد) + - uses: actions/setup-node@v4 + with: + node-version: 20.x + cache: 'npm' + + # نصب وابستگی‌ها (در صورت وجود) + - run: | + if [ -f package.json ]; then + npm ci || true + npm run build --if-present || true + npm test || true + fi + + # اجرای تست برای زبان‌های دیگر (به شکل ساده) + - run: | + if [ -f requirements.txt ]; then pip install -r requirements.txt && pytest || true; fi + if [ -f Cargo.toml ]; then cargo test || true; fi + if [ -f go.mod ]; then go test ./... || true; fi + + # در صورت موفقیت تست‌ها، Merge خودکار + - name: Merge PR + uses: fastify/github-action-merge-dependabot@v3 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + merge-method: squash