release-please-action icon indicating copy to clipboard operation
release-please-action copied to clipboard

Action not creating release PR when alternate src/ path provided

Open mountaindude opened this issue 3 years ago • 7 comments

Using the Release-please action in this repo: https://github.com/ptarmiganlabs/butler-sheet-icons

The same config that works in other repos just won't work in this one. Which is strange. Release-please used to work for this repo too, but stopped working sometime since last release (a few weeks ago). Can't recall changing anything relating to release-please. Can more verbose logging be turned on for the Release Please action to show what's going on?

The action triggers fine when I push something to main branch, but then the action doesn't recognise any of the commits that have been made (fix: , refactor: etc).

The action log looks like this:

Run GoogleCloudPlatform/release-please-action@v2
  with:
    token: ***
    release-type: node
    package-name: butler-sheet-icons
    path: src
    default-branch: main
    fork: false
    clean: true
    bump-minor-pre-major: false
    bump-patch-for-minor-pre-major: false
    monorepo-tags: false
    pull-request-title-pattern: chore${scope}: release${component} ${version}
  env:
    GITHUB_REF: refs/heads/main
    GITHUB_TOKEN: ***
(node:1519) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
⚠ No merged release PR found
✖ Unable to build candidate
✔ found 13 commits since 11029d24afd0cf19cb48552a40d56cf668a24368
✔ release as patch: There are 0 BREAKING CHANGES and 0 features
⚠ no user facing commits found since 11029d24afd0cf19cb48552a40d56cf668a24368

The workflow looks like this (link):

name: release-please

on:
  push:
    branches:
      - main

jobs:
  release-please:
    runs-on: ubuntu-latest
    env:
      GITHUB_REF: ${{ github.ref }}
      # GITHUB_USER: ${{ secrets.GITHUB_USER }}
      GITHUB_TOKEN: ${{ secrets.PAT }}
    steps:
      - name: Show github.ref
        run: echo "$GITHUB_REF"

      - uses: GoogleCloudPlatform/release-please-action@v2
        id: release
        if: |
          github.repository_owner == 'ptarmiganlabs'
        with:
          token: ${{ env.GITHUB_TOKEN }}
          release-type: node
          package-name: butler-sheet-icons
          path: src
          default-branch: main

      - name: Show output from Release-Please
        if: ${{ steps.release.outputs.release_created }}
        run: |
          echo "release_created: ${{ steps.release.outputs.release_created }}"
          echo "upload_url: ${{ steps.release.outputs.upload_url }}"
          echo "html_url: ${{ steps.release.outputs.html_url }}"
          echo "tag_name: ${{ steps.release.outputs.tag_name }}"
          echo "major: ${{ steps.release.outputs.major }}"
          echo "minor: ${{ steps.release.outputs.minor }}"
          echo "patch: ${{ steps.release.outputs.patch }}"
          echo "sha: ${{ steps.release.outputs.sha }}"
          echo "pr: ${{ steps.release.outputs.pr }}"

mountaindude avatar Sep 28 '21 11:09 mountaindude

Not sure if it provides any clues, but the text "found 13 commits since 11029d24afd0cf19cb48552a40d56cf668a24368" stays the same even though I add more commits. I would think that number should go up, even though not all commits are fix:/feat:/refactor: etc.

mountaindude avatar Sep 28 '21 12:09 mountaindude

Think I found the reason why I don't get any release PR.

The path setting is described in the docs as "create a release from a path other than the repository's root". That's what I want to do, setting path: src. So I only want to include stuff in the ./src tree in the releases.

But it looks like release-please then only looks for conventional commits in ./src. For example, if I had an error in the CI/CD workflow files and committed a change with a "fix: Docker builds now working again", that commit wouldn't be picked up by release-please, as it's not in the ./src directory tree.

This is probably by design (i.e. not a bug), but the docs could maybe explain it a bit more explicitly.

On the other hand I would argue that commits from the entire repo are usually of interest, even though I may have placed my package.json and all source code in a subdirectory.

Oh yes: I am working on a Node.js project, meaning that if package.json is placed in ./src I have to set path: src in order for release-please to work. Otherwise I get a "Not found" error (or something like that).

Sooo.... Maybe it could be useful to have an option specifying where the package.json (for Node projects) is located. path could then be left in the repo root dir (covering the entire repo), but release-please would still be able to find and update package.json as expected. Would require some further consideration of course.

mountaindude avatar Sep 28 '21 16:09 mountaindude

...then again, using manifest files (instead of placing all config in the GitHub Actions workflow file) might provide some more flexibility. But even so, I don't see how to stash away the Node.js source code in it's own folder under the root folder, documentation in a separate folder under root etc - while still having release-please correctly updating the package.json in the source folder.

Or am I missing something?

mountaindude avatar Sep 29 '21 06:09 mountaindude

But it looks like release-please then only looks for conventional commits in ./src.

The path variable was added as a way to initially support repos that release multiple packages from the same project.

If I'm understanding your use-case, you only have a single package, but the package.json, is in src/package.json?

bcoe avatar Oct 04 '21 15:10 bcoe

I'm having the same issues as above. As a workaround, I went to the last commit that worked and am using that version of release-please like so, which seems to have worked:

on:
  push:
    branches:
      - main
name: release-please
jobs:
  release-please:
    runs-on: ubuntu-latest
    steps:
      - uses: GoogleCloudPlatform/release-please-action@973b63d3d58b9a5a9fed0dd512501ad5a9ab319b
        with:
          release-type: simple
          package-name: release-please-action

I've noticed this in several of our repos that use this action.

jakeyheath avatar Oct 04 '21 16:10 jakeyheath

@jacobrheath in the sample you've shared here, it doesn't look like you're using the src/ argument to point to an alternate folder.

Could you describe to me the issue you're seeing in more detail in a new issue, as I think the problem you're having may be slightly different.

bcoe avatar Oct 04 '21 16:10 bcoe

Ah I see, I might have missed that part. Essentially when using GoogleCloudPlatform/release-please-action@v2, the action wasn't creating a release PR when one didn't exist. For example, I added release-please for the first time to a new repo, merged it to the main branch. However, release-please never created the next release's PR. I noticed similar behavior in other repos that had already been using release-please. After a release was created, and a new PR was merged to main, no new release PR was created.

After reverting the versions to GoogleCloudPlatform/[email protected], this behavior seemed to stop and the PRs showed up again and were working as expected. I looked through the diff from 2.33.0 and 2.34.0, but didn't see much that would cause an issue.

jakeyheath avatar Oct 04 '21 17:10 jakeyheath

Closing as it seems the question is answered.

tmatsuo avatar Oct 04 '22 23:10 tmatsuo