|
5 | 5 | types: [opened, edited, synchronize, reopened]
|
6 | 6 |
|
7 | 7 | jobs:
|
| 8 | + # THIS IS SUPPOSED TO GO BEFORE validate-commits |
| 9 | + # commenting this for now as this needs rework |
| 10 | + |
| 11 | + # check-merge-commits: |
| 12 | + # runs-on: ubuntu-latest |
| 13 | + # steps: |
| 14 | + # - uses: actions/checkout@v3 |
| 15 | + # with: |
| 16 | + # fetch-depth: 0 |
| 17 | + # token: ${{ secrets.GITHUB_TOKEN }} |
| 18 | + # |
| 19 | + # - name: Check and Fix Merge Commits |
| 20 | + # id: check_merge_commits |
| 21 | + # run: | |
| 22 | + # # Get the PR branch and base branch |
| 23 | + # PR_BRANCH="${{ github.event.pull_request.head.ref }}" |
| 24 | + # BASE_BRANCH="${{ github.event.pull_request.base.ref }}" |
| 25 | + # |
| 26 | + # # Get all merge commits in the PR |
| 27 | + # |
| 28 | + # git config --global user.name ${{ secrets.NEW_RELIC_GITHUB_SERVICE_ACCOUNT_USERNAME }} |
| 29 | + # git config --global user.email ${{ secrets.NEW_RELIC_GITHUB_SERVICE_ACCOUNT_EMAIL }} |
| 30 | + # |
| 31 | + # git fetch origin $PR_BRANCH |
| 32 | + # git fetch origin $BASE_BRANCH |
| 33 | + # |
| 34 | + # MERGE_COMMITS=$(git log --merges "origin/$BASE_BRANCH..origin/$PR_BRANCH" --format="%H") |
| 35 | + # |
| 36 | + # if [ ! -z "$MERGE_COMMITS" ]; then |
| 37 | + # echo "Found merge commits in PR, converting to conventional commits..." |
| 38 | + # |
| 39 | + # for commit in $MERGE_COMMITS; do |
| 40 | + # # Get the merge commit message |
| 41 | + # echo "Processing commit: $commit" |
| 42 | + # MERGE_MSG=$(git log -1 --format="%B" $commit) |
| 43 | + # |
| 44 | + # # Extract meaningful information from merge commit |
| 45 | + # TITLE=$(echo "$MERGE_MSG" | head -n 1) |
| 46 | + # echo "$commit current title: $TITLE" |
| 47 | + # |
| 48 | + # # Create conventional commit format |
| 49 | + # # Default to 'chore' type if cannot determine |
| 50 | + # NEW_MSG="chore: $TITLE" |
| 51 | + # echo "$commit new title: $NEW_MSG" |
| 52 | + # |
| 53 | + # # Amend the commit with new message |
| 54 | + # echo "Amending commit: $commit" |
| 55 | + # git checkout $commit |
| 56 | + # echo "$commit: checked out" |
| 57 | + # git commit --amend -m "$NEW_MSG" --no-edit |
| 58 | + # echo "$commit: amended" |
| 59 | + # done |
| 60 | + # |
| 61 | + # # Push the changes back to the PR branch |
| 62 | + # # very risky, but just want to give this a try |
| 63 | + # git push origin HEAD:$PR_BRANCH -f |
| 64 | + # echo "$commit: force pushed with the new title '$NEW_MSG'" |
| 65 | + # fi |
| 66 | + |
8 | 67 | validate-commits:
|
9 |
| - needs: check-merge-commits |
| 68 | +# needs: check-merge-commits |
10 | 69 | runs-on: ubuntu-latest
|
11 | 70 | steps:
|
12 | 71 | - name: Checkout code
|
|
0 commit comments