summaryrefslogtreecommitdiff
path: root/.github/workflows/check_branch.yml
blob: 4a74cbd458190c7da169fcb24b550f616cf7ba22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# We bidirectionally synchronize github.com/ruby/ruby.git's master branch and
# git.ruby-lang.org/ruby.git's master branch.
# We can use a pull request's merge button only on the master branch.
#
# Therefore, we require to pass this "check_branch" on all protected branches
# to prevent us from accidentally pushing commits to GitHub directly.
#
# Details: https://bugs.ruby-lang.org/issues/16094
name: pull_request
on: [pull_request]
jobs:
  check_branch:
    runs-on: ubuntu-latest
    steps:
      - name: Check if branch is master
        run: |
          if [ "$BASE_REF" != master ]; then
            echo "Only master branch accepts a pull request, but it's '$BASE_REF'."
            exit 1
          fi
        env:
          BASE_REF: ${{ github.base_ref }}