From b96d775537c53180a6d772acdd435ac903aec35b Mon Sep 17 00:00:00 2001 From: Patrick szymkowiak Date: Wed, 11 Mar 2026 21:55:00 +0100 Subject: [PATCH] ci: add PR template + target branch check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PR template reminds contributors to target develop - CI workflow labels PRs targeting master with 'wrong-base' and posts a comment - Excludes develop→master PRs (maintainer releases) Signed-off-by: Patrick Signed-off-by: Patrick szymkowiak --- .github/PULL_REQUEST_TEMPLATE.md | 13 ++++++++ .github/workflows/pr-target-check.yml | 43 +++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/pr-target-check.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..df3e32a3d --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,13 @@ +## Summary + + +- + +## Test plan + + +- [ ] `cargo fmt --all && cargo clippy --all-targets && cargo test` +- [ ] Manual testing: `rtk ` output inspected + +> **Important:** All PRs must target the `develop` branch (not `master`). +> See [CONTRIBUTING.md](../blob/master/CONTRIBUTING.md) for details. diff --git a/.github/workflows/pr-target-check.yml b/.github/workflows/pr-target-check.yml new file mode 100644 index 000000000..60211f1cd --- /dev/null +++ b/.github/workflows/pr-target-check.yml @@ -0,0 +1,43 @@ +name: PR Target Branch Check + +on: + pull_request_target: + types: [opened, edited] + +jobs: + check-target: + runs-on: ubuntu-latest + # Skip develop→master PRs (maintainer releases) + if: >- + github.event.pull_request.base.ref == 'master' && + github.event.pull_request.head.ref != 'develop' + steps: + - name: Add wrong-base label + uses: actions/github-script@v7 + with: + script: | + const pr = context.payload.pull_request; + + // Add label + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + labels: ['wrong-base'] + }); + + // Post comment + const body = `👋 Thanks for the PR! It looks like this targets \`master\`, but all PRs should target the **\`develop\`** branch. + + Please update the base branch: + 1. Click **Edit** at the top right of this PR + 2. Change the base branch from \`master\` to \`develop\` + + See [CONTRIBUTING.md](https://github.com/${context.repo.owner}/${context.repo.repo}/blob/master/CONTRIBUTING.md) for details.`; + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr.number, + body: body + });