Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/based on vnext/1.43 #4

Merged
merged 17 commits into from
Feb 7, 2024
41 changes: 29 additions & 12 deletions .github/workflows/blank.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,46 @@
name: Check Feature Branch Origin
name: Check Commits

on:
pull_request:
types:
- opened
- synchronize
branches:
- develop

jobs:
check-branch-origin:
check-commits:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get common ancestor commit
id: merge-base
run: echo "::set-output name=commit::$(git merge-base ${{ github.base_ref }} ${{ github.head_ref }})"
- name: fetch
run: git fetch

- name: Verify branch origin
- name: Get list of vnext branches
id: get-branches
run: |
common_ancestor_commit="${{ steps.merge-base.outputs.commit }}"
first_commit_in_feature_branch=$(git rev-list --max-parents=0 HEAD)
branches=$(git branch -r | grep 'origin/vnext/*' | sed 's/origin\///')
echo "::set-output name=branches::$branches"

if [ "$common_ancestor_commit" != "$first_commit_in_feature_branch" ]; then
echo "Error: Feature branch was not created from master."
exit 1
fi
- 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."
1 change: 1 addition & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
hello world
changes in prep for v1.43
changes made in feature/based-on-vnext/1.43
Loading