Просмотр исходного кода

docs(pr template): fix link to CONTRIBUTING.adoc (#1141)

James Read 21 часов назад
Родитель
Сommit
54bbef637a
2 измененных файлов с 40 добавлено и 1 удалено
  1. 1 1
      .github/PULL_REQUEST_TEMPLATE.md
  2. 39 0
      .github/workflows/check-target.yml

+ 1 - 1
.github/PULL_REQUEST_TEMPLATE.md

@@ -13,7 +13,7 @@ Helpful information to understand the project can be found here: [CONTRIBUTING](
 # Checklist
 Please put a X in the boxes as evidence of reading through the checklist.
 
-- [ ] I have read the [CONTRIBUTORS](CONTRIBUTORS.adoc) guide
+- [ ] I have read the [CONTRIBUTING](https://github.com/OliveTin/OliveTin/blob/main/CONTRIBUTING.adoc) guide
   - [ ] I considered the "3 line" suggestion.
   - [ ] I followed the "1 logical change" rule.
 - [ ] I have forked the project, and raised this PR on a feature branch.

+ 39 - 0
.github/workflows/check-target.yml

@@ -0,0 +1,39 @@
+name: Check target
+
+# Only release PRs (next -> main, from this repository) may target main.
+# Features, fixes and docs must target next. This runs on every PR so that it
+# can be a required status check; PRs that do not target main always pass.
+
+on:
+  pull_request:
+    types:
+      - opened
+      - reopened
+      - synchronize
+      - edited
+
+permissions: {}
+
+jobs:
+  check-target:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check target branch
+        env:
+          BASE_REF: ${{ github.event.pull_request.base.ref }}
+          HEAD_REF: ${{ github.event.pull_request.head.ref }}
+          HEAD_REPO: ${{ github.event.pull_request.head.repo.full_name }}
+          THIS_REPO: ${{ github.repository }}
+        run: |
+          if [ "$BASE_REF" != "main" ]; then
+            echo "PR targets '$BASE_REF', OK."
+            exit 0
+          fi
+
+          if [ "$HEAD_REPO" = "$THIS_REPO" ] && [ "$HEAD_REF" = "next" ]; then
+            echo "Release PR from next to main, OK."
+            exit 0
+          fi
+
+          echo "::error title=Wrong target branch::Only release PRs from 'next' may target 'main'. Please edit this PR and change its base branch to 'next'."
+          exit 1