Feature/1.43 test #25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Commits on develop | |
on: | |
pull_request: | |
branches: | |
- develop | |
types: | |
- opened | |
- synchronize | |
jobs: | |
check-commits: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: fetch | |
run: git fetch | |
- name: Get list of vnext branches | |
id: get-branches | |
run: | | |
branches=$(git branch -r | grep 'origin/vnext/*' | sed 's/origin\///') | |
echo "::set-output name=branches::$branches" | |
- name: Check commit hashes | |
id: check-commits | |
run: | | |
branches="${{ steps.get-branches.outputs.branches }}" | |
commit_hashes=$(git log --pretty=format:"%H" ${{ github.event.pull_request.base.sha }}^..${{ github.event.pull_request.head.sha }}) | |
for hash in $commit_hashes; do | |
for branch in $branches; do | |
echo "Checking: $hash in $branch" | |
if git merge-base --is-ancestor $hash origin/$branch; then | |
echo "Error: Commit hash $hash found in branch $branch" | |
exit 1 | |
fi | |
done | |
done | |
echo "All commit hashes are valid." | |
- name: Echo success message | |
if: steps.check-commits.outcome == 'success' | |
run: echo "Workflow completed successfully." |