diff --git a/.github/workflows/warn-release-pr.yml b/.github/workflows/warn-release-pr.yml new file mode 100644 index 0000000000..5da39d93a3 --- /dev/null +++ b/.github/workflows/warn-release-pr.yml @@ -0,0 +1,31 @@ +name: Warn on Release Branch + +on: + pull_request: + types: [opened] + +jobs: + warn-on-release-branch: + runs-on: ubuntu-latest + + steps: + - name: Check if branch name starts with "release" + id: check_branch + run: | + if [[ "${{ github.head_ref }}" == release* ]]; then + echo "branch_is_release=true" >> $GITHUB_ENV + else + echo "branch_is_release=false" >> $GITHUB_ENV + fi + + - name: Post warning comment + if: env.branch_is_release == 'true' + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + body: "⚠️ Warning: PR should be **merged** and not **rebased**." + })