googleapis / release-please-action

automated releases based on conventional commits
Apache License 2.0
1.64k stars 207 forks source link

Two pull requests. After merging the first one, merging the second one won't create release pull request #902

Closed hongmingavaya closed 9 months ago

hongmingavaya commented 9 months ago

TL;DR

There are two pull requests pending for approval. Each of them has conventional commit messages (fix:xxx). Merging of second one won't create a release pull request after the first one has been merged.

Expected behavior

  1. Create a branch A based on latest main branch, make some changes with commit comment “fix:A”, then create a pull request A to merge the changes in branch A into main branch.

  2. Create a branch B based on latest main branch, make some changes with commit comment to “fix:B”, then create a pull request B to merge the changes in branch B into main branch.

  3. Merge pull request A into main branch, the changes in pull request A is successfully merged into main branch and a new release A is cut.

  4. Merge pull request B into main branch, the changes in pull request B is successfully merged into main branch and a new release pull request is created.

Observed behavior

  1. Merge pull request B into main branch, the changes in pull request B is successfully merged into main branch and no new release pull request is created and following log is displayed:

❯ targetBranch: main ❯ commit could not be parsed: 9f7c798637181f4ea10624b1f9ef8ae57028e236 Merge pull request #159 from customer/testbranch ❯ commits: 0 ✔ Considering: 0 commits ✔ No commits for path: ., skipping

Action YAML

- name: Create pull request
        id: create_pr
        uses: google-github-actions/release-please-action@v3
        with:
          release-type: simple
          default-branch: main
          monorepo-tags: true
          component: main
          labels: |
            autorelease: pending
            automerge

      - name: Approve pull request 1
        id: approve_pr_1
        uses: hmarr/auto-approve-action@v3
        with:
          github-token: token1
          pull-request-number: ${{ fromJson(steps.create_pr.outputs.pr).number }}

      - name: Merge pull Request
        id: merge_pr
        uses: pascalgn/automerge-action@v0.15.5
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PULL_REQUEST: ${{ steps.create_pr.outputs.pr && fromJson(steps.create_pr.outputs.pr).number }}
          UPDATE_METHOD: merge

      - name: Release Version
        uses: google-github-actions/release-please-action@v3
        with:
          release-type: simple
          default-branch: main
          monorepo-tags: true
          component: main
          token: token1

Log output

No response

Additional information

No response

chingor13 commented 9 months ago

What does the commit history look like on the main branch? Any PR title is actually irrelevant to what release-please looks at in the release.

It looks like you are using plain merges which is not advised (see https://github.com/googleapis/release-please#linear-git-commit-history-use-squash-merge).

Please re-open with additional information otherwise, we are just speculating.

hongmingavaya commented 9 months ago

What does the commit history look like on the main branch? Any PR title is actually irrelevant to what release-please looks at in the release.

It looks like you are using plain merges which is not advised (see https://github.com/googleapis/release-please#linear-git-commit-history-use-squash-merge).

Please re-open with additional information otherwise, we are just speculating.

Below is the commit history of main branch:

image

And following is the output of google-github-actions/release-please-action@v3 after merged PR 2

Run google-github-actions/release-please-action@v3 ✔ Looking for latest release on branch: main with prefix: main ❯ Fetching merge commits on branch main with cursor: undefined ❯ Found latest release pull request: 92 version: 1.1.13 ❯ Fetching releases with cursor undefined ❯ found release for main Version { major: 1, minor: 1, patch: 13, preRelease: undefined, build: undefined } ❯ found release for main Version { major: 1, minor: 1, patch: 12, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 11, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 10, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 9, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 8, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 7, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 6, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 5, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 4, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 3, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 2, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 1, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 0, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 7, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 6, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 5, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 4, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 3, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 2, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 1, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found 2 possible releases. [ Version { major: 1, minor: 1, patch: 13, preRelease: undefined, build: undefined }, Version { major: 1, minor: 1, patch: 13, preRelease: undefined, build: undefined } ] ✔ Building releases ✔ Building strategies by path ❯ .: simple ✔ Looking for latest release on branch: main with prefix: main ❯ Fetching merge commits on branch main with cursor: undefined ❯ Found latest release pull request: 92 version: 1.1.13 ❯ Fetching releases with cursor undefined ❯ found release for main Version { major: 1, minor: 1, patch: 13, preRelease: undefined, build: undefined } ❯ found release for main Version { major: 1, minor: 1, patch: 12, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 11, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 10, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 9, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 8, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 7, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 6, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 5, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 4, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 3, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 2, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 1, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 1, patch: 0, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 7, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 6, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 5, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 4, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 3, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 2, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found release for main Version { major: 1, minor: 0, patch: 1, preRelease: undefined, build: undefined } ❯ SHA not found in recent commits to branch main, skipping ❯ found 2 possible releases. [ Version { major: 1, minor: 1, patch: 13, preRelease: undefined, build: undefined }, Version { major: 1, minor: 1, patch: 13, preRelease: undefined, build: undefined } ] ✔ Building pull requests ✔ Building strategies by path ❯ .: simple ✔ Collecting release commit SHAs ❯ release search depth: 400 ❯ Fetching releases with cursor undefined ❯ Found release for path ., main-v1.1.13 ❯ release for path: ., version: 1.1.13, sha: af5166bad3b9c71986e48e213ecb0d8ee9647259 ✔ Collecting commits since all latest releases ❯ commit search depth: 500 ❯ Set(1) { 'af5166bad3b9c71986e48e213ecb0d8ee9647259' } ❯ Fetching merge commits on branch main with cursor: undefined ❯ Backfilling file list for commit: 19a256ea1bed10646fa1379986e4d529ab0b1065 ❯ Found 2 files ❯ Backfilling file list for commit: 54fbfd7d2e18e86c1386ffe52ba1a552d2ce7fc9 ❯ Found 1 files ❯ Backfilling file list for commit: 2ca36a3881cf220e6d82dff71d2003c8d042263c ❯ Found 1 files ❯ Backfilling file list for commit: d1ce154208a736c8ba7b06de57d6c753ee4a3aa3 ❯ Found 1 files ❯ Backfilling file list for commit: 28b92fb09e5bef20ba21f47baa9ae30a4a1ab4ec ❯ Found 1 files ❯ Backfilling file list for commit: 770fed5103afd3a7308c10c6b00aee6a3610d4ac ❯ Found 2 files ❯ Backfilling file list for commit: 8dd85e12ca05eb4e350ab728e4c4ed41e44e3087 ❯ Found 1 files ❯ Backfilling file list for commit: 748df90567689a1ab6d484896bfdaa60674ed2c8 ❯ Found 1 files ❯ Backfilling file list for commit: fd17191bdc9b0aba54e0300ac8870cf0f3c2bdb5 ❯ Found 1 files ❯ Backfilling file list for commit: 86568b84b8dd554e5973ad91c047fbc98686f3e5 ❯ Found 1 files ❯ Backfilling file list for commit: 3e2c3c74e1987d4a98389201310ea0e3a3d368b7 ❯ Found 1 files ❯ Backfilling file list for commit: b8dfc66ef7fab82016b211b97e5245120a5738bf ❯ Found 1 files ❯ Backfilling file list for commit: 98052a6055f9fbdd2596f1d683efc297ebec9c98 ❯ Found 1 files ❯ Backfilling file list for commit: 5ba5043d8c866a6b6fe91c3e554787dbe2f38031 ❯ Found 2 files ❯ Backfilling file list for commit: 8143b12fa175e0edd9cd93c86534f537adc5e51d ❯ Found 1 files ❯ Backfilling file list for commit: cb30bf857f678549943647426bb2d84aaf01efdf ❯ Found 1 files ❯ Backfilling file list for commit: f1a39c35dd4a63fae8618585e1e7f74953b8e3bc ❯ Found 4 files ✔ Splitting 1 commits by path ✔ Building candidate release pull request for path: . ❯ type: simple ❯ targetBranch: main ❯ commits: 1 ✔ Considering: 1 commits ❯ component: main ❯ pull request title pattern: undefined ✔ No user facing commits found since af5166bad3b9c71986e48e213ecb0d8ee9647259 - skipping

BTW, under github's Settings/General/Pull Requests, Allow squash merging is checked and the default commit message is set to "pull requst title and commit details"

hongmingavaya commented 8 months ago

@chingor13: I added comment, can you take a look?

miguelappleton commented 5 months ago

Any updates on this? I'm having a similar issue...

jaysonpotter commented 3 months ago

I'm also having the same issue and have created a repo and issue to help illustrate the issue in a straightforward and simple way, including a recording of the issue in action; https://github.com/googleapis/release-please-action/issues/998

romeshqubits commented 3 months ago

I did the same what @chingor13 suggested and it worked well for me.

While merging(approving) the PR, use SQUASH AND MERGE instead of using MERGE PULL REQUEST.

jaysonpotter commented 3 months ago

I appreciate the recommendation, @romeshqubits, but it is not a requirement based on the documentation. In my opinion, release automation tools should not dictate the method in which a team chooses to handle their commit strategy. I want full audit trails, history, and metadata; squashing limits that.

Since reporting this issue, https://github.com/googleapis/release-please-action/issues/998, I have moved onto semantic-release. semantic-release has worked reliably in all of my testing and does not fail due to the issue explained initially, or the issue I reported.

CC: @chingor13