diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml deleted file mode 100644 index 5a725ad..0000000 --- a/.github/workflows/auto-merge.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: "Automerge Dependabot PRs" - -on: pull_request - -permissions: - pull-requests: write - contents: write - -jobs: - auto-merge: - runs-on: ubuntu-latest - if: github.actor == 'dependabot[bot]' - steps: - - name: "Get Dependabot metadata" - id: dependabot-metadata - uses: dependabot/fetch-metadata@v1.1.1 - with: - github-token: ${{ github.token }} - - - name: "Approve the PR" - run: gh pr review --approve "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GH_TOKEN: ${{ secrets.AUTOTOK }} - - # Don't auto-merge major version updates - - name: "Enable auto-merge for Dependabot PRs" - if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }} - run: gh pr merge --auto --squash "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GH_TOKEN: ${{ secrets.AUTOTOK }} diff --git a/.github/workflows/test_pr.yml b/.github/workflows/test_pr.yml index 66a6afe..da1b1ad 100644 --- a/.github/workflows/test_pr.yml +++ b/.github/workflows/test_pr.yml @@ -4,7 +4,7 @@ on: push: branches: - main - pull_request: + pull_request_target: branches: - main @@ -12,8 +12,8 @@ env: BUILD_TYPE: Release jobs: - build: - runs-on: [self-hosted, dcam] + test: + runs-on: [ self-hosted, dcam ] permissions: actions: write @@ -54,3 +54,29 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build run: ctest -C ${{env.BUILD_TYPE}} -L dcam --output-on-failure + + auto-merge: + name: "Auto-merge Dependabot PRs" + needs: test + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' }} + steps: + - name: "Get Dependabot metadata" + id: dependabot-metadata + uses: dependabot/fetch-metadata@v1.1.1 + with: + github-token: ${{ github.token }} + + - name: "Approve the PR" + run: gh pr review --approve "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.PAT }} + + # Don't auto-merge major version updates + - name: "Auto-merge the PR" + if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }} + run: gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.PAT }} \ No newline at end of file