-
Notifications
You must be signed in to change notification settings - Fork 8
31 lines (27 loc) · 1.07 KB
/
check-pr-base.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
name: Git tree checks
on:
pull_request:
types: [opened, edited, reopened, synchronize]
permissions:
pull-requests: write
contents: read
jobs:
check_base_ref:
name: Release branch restriction
runs-on: ubuntu-latest
steps:
- name: Change base to master if needed
if: |
github.event_name == 'pull_request' &&
github.event.pull_request.base.ref == 'release/latest' &&
! startsWith(github.event.pull_request.head.ref, 'release/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo 'Updating PR '"#${{ github.event.pull_request.number }}"' to use base `master`'
echo 'If you do want to release your changes directly by merging into `release/latest`, your branch must start with `release/`.'
curl -X PATCH \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} \
-d '{"base": "master"}'