Explorar el Código

Move dependenbot auto-merge within the main workflow (#331)

* Move dependenbot auto-merge within the main workflow

This ensures auto-approve and auto-merge for dependabot only occurs when CI passes.

* Only trigger dependabot job in PRs
Loris Leiva hace 11 meses
padre
commit
5f629d119f
Se han modificado 2 ficheros con 19 adiciones y 22 borrados
  1. 0 22
      .github/workflows/dependabot-auto-merge.yml
  2. 19 0
      .github/workflows/main.yml

+ 0 - 22
.github/workflows/dependabot-auto-merge.yml

@@ -1,22 +0,0 @@
-name: Dependabot auto-merge
-on: pull_request
-
-permissions:
-  contents: write
-  pull-requests: write
-
-jobs:
-  dependabot:
-    runs-on: ubuntu-latest
-    if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'codama-idl/codama'
-    steps:
-      - name: Auto-approve the PR
-        run: gh pr review --approve "$PR_URL"
-        env:
-          PR_URL: ${{ github.event.pull_request.html_url }}
-          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-      - name: Enable auto-merge
-        run: gh pr merge --auto --squash "$PR_URL"
-        env:
-          PR_URL: ${{ github.event.pull_request.html_url }}
-          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

+ 19 - 0
.github/workflows/main.yml

@@ -101,3 +101,22 @@ jobs:
         env:
         env:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
           NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
+
+  dependabot:
+    runs-on: ubuntu-latest
+    if: github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'codama-idl/codama'
+    needs: [lint, tests]
+    permissions:
+      contents: write
+      pull-requests: write
+    steps:
+      - name: Auto-approve the PR
+        run: gh pr review --approve "$PR_URL"
+        env:
+          PR_URL: ${{ github.event.pull_request.html_url }}
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+      - name: Enable auto-merge
+        run: gh pr merge --auto --squash "$PR_URL"
+        env:
+          PR_URL: ${{ github.event.pull_request.html_url }}
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}