mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
Add .github/workflows/check-based-on-master (#1991)
This commit is contained in:
parent
9bb7905d26
commit
06cf4e0f70
2 changed files with 30 additions and 0 deletions
12
.github/workflows/check-based-on-master.sh
vendored
Executable file
12
.github/workflows/check-based-on-master.sh
vendored
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -x -e
|
||||
MASTER_ID=$(git rev-parse "origin/master")
|
||||
CURRENT_ID=$(git rev-parse "HEAD")
|
||||
BASED_ON_ID=$(git merge-base "$CURRENT_ID" "$MASTER_ID")
|
||||
|
||||
if [[ "$MASTER_ID" != "$BASED_ON_ID" ]]
|
||||
then
|
||||
echo "Current branch is based on $BASED_ON_ID, which is not the latest \`master\`: $MASTER_ID. Consider \`git rebase origin/master\`."
|
||||
exit 1
|
||||
fi
|
18
.github/workflows/check-based-on-master.yml
vendored
Normal file
18
.github/workflows/check-based-on-master.yml
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
name: check-based-on-master
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [ master ]
|
||||
jobs:
|
||||
hook:
|
||||
name: Check whether this branch is based on master branch
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repo @ current branch
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 1000 # Hopefully current branch is less than 1000 commits from main
|
||||
- name: Fetch origin/master
|
||||
run: "git fetch origin master"
|
||||
- name: Run check-based-on-master
|
||||
run: .github/workflows/check-based-on-master.sh
|
Loading…
Reference in a new issue