forked from magma/magma
-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (45 loc) · 1.6 KB
/
check-rebase.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Copyright 2022 The Magma Authors.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "Check Rebase"
on:
pull_request:
branches:
- master
- 'v1.*'
jobs:
checkRebase:
runs-on: ubuntu-latest
env:
HEAD_FULL_NAME: "${{github.event.pull_request.head.repo.full_name}}"
BASE_FULL_NAME: "${{github.event.pull_request.base.repo.full_name}}"
HEAD_SHA: "${{ github.event.pull_request.head.sha }}"
BASE_SHA: "${{ github.event.pull_request.base.sha }}"
steps:
- name: Checkout Head
uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # pin@v2
with:
repository: "${{env.HEAD_FULL_NAME}}"
fetch-depth: 0
- name: Checkout Base
uses: actions/checkout@7884fcad6b5d53d10323aee724dc68d8b9096a2e # pin@v2
with:
repository: "${{env.BASE_FULL_NAME}}"
fetch-depth: 0
- name: Check Commits Hash
run: |
COMMON_SHA="$(git merge-base $BASE_SHA $HEAD_SHA)"
if [ "${COMMON_SHA}" = "$BASE_SHA" ]; then
echo "Merge Succeeded : It is rebased"
exit 0
else
echo "Merge Failed : It is not rebased"
exit 1
fi