Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

ci: Enforce `dev` as base branch for development (#8369)

Reinier van der Leer5d4d2486da1d
diff --git a/.github/workflows/repo-pr-enforce-base-branch.yml b/.github/workflows/repo-pr-enforce-base-branch.yml
new file mode 100644
index 0000000000..3d4bd9096a
--- /dev/null
+++ b/.github/workflows/repo-pr-enforce-base-branch.yml
@@ -0,0 +1,21 @@
+name: Repo - Enforce dev as base branch
+on:
+ pull_request_target:
+ branches: [ master ]
+ types: [ opened ]
+
+jobs:
+ check_pr_target:
+ runs-on: ubuntu-latest
+ permissions:
+ pull-requests: write
+ steps:
+ - name: Check if PR is from dev or hotfix
+ if: ${{ !(startsWith(github.event.pull_request.head.ref, 'hotfix/') || github.event.pull_request.head.ref == 'dev') }}
+ run: |
+ gh pr comment ${{ github.event.number }} --repo "$REPO" \
+ --body $'This PR targets the `master` branch but does not come from `dev` or a `hotfix/*` branch.\n\nAutomatically setting the base branch to `dev`.'
+ gh pr edit ${{ github.event.number }} --base dev --repo "$REPO"
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ REPO: ${{ github.repository }}