feedback icon indicating copy to clipboard operation
feedback copied to clipboard

Squash merge issue

Open ayachensiyuan opened this issue 3 years ago • 0 comments

CASE:

I have a repo on Github where the main branch uses dev and the IT staff builds their own branch for PR submissions to update the dev branch.

UT script like this:

name: Unit Test

on:
  pull_request:
    branches:
      - main
      - dev
 
jobs:
  unit-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          ref: ${{ github.head_ref }}
          repository: ${{ github.event.pull_request.head.repo.full_name }}

      - name: Setup node
        uses: actions/[email protected]
        with:
          node-version: 14

      - name: Setup .NET Core
        uses: actions/setup-dotnet@v1
        with:
          dotnet-version: 3.1.x 

      - name: Setup project
        run: |
          npm run setup

      - name: Unit Test
        run: |
          xvfb-run -a npx lerna run test:unit --stream
          npx codecov

This script will upload report after run of all the tests, the npx codecov command looks for coverage reports in the working directory and uploads them.

ISSUE:

When I use Merge Pull Request to confirm merge, I find that the PR report data on the website is automatically merged into dev and the reported data appears on the main page. That is what I want.

However, we usually use squarsh and merge to merge PR, which results in reports that will always be in the previous branch you merged, the merged report data will not be transferred to the dev branch.

I think the reason for this FAULT result is that Codecov will use the commit_id as the search index for each data, Merge pull request will not change the commit_id, and Squarsh and merge will generate a new commit_id. I think this behavior should be a BUG, and my current solution is to add another trigger on push. Such as:

name: Unit Test

on:
  pull_request:
    branches:
      - main
      - dev
      - ga
      - hotfix/**/*
  push:
    branches:
      - main
      - dev
      - ga
      - hotfix/**/*
 
jobs:
  unit-test:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout-pr
        if: ${{ github.event_name == 'pull_request' }}
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          ref: ${{ github.head_ref }}
          repository: ${{ github.event.pull_request.head.repo.full_name }}
          
      - name: Checkout
        if: ${{ github.event_name != 'pull_request' }}
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          ref: ${{ github.ref_name }}
          repository: ${{ github.repository }}

But that's not the way we want to do it, because it takes a lot of time to finish running UT, so the data reported on dev is inaccurate when running UT on the dev branch.

Do you have any better suggestions for fixing this problem?

Thanks

ayachensiyuan avatar Jul 28 '22 07:07 ayachensiyuan