googleapis / release-please-action

automated releases based on conventional commits
Apache License 2.0
1.7k stars 209 forks source link

`outputs.releases_created` has different behavior compared to v3 #912

Open psYifanChen opened 10 months ago

psYifanChen commented 10 months ago

TL;DR

I am working on a monorepo. When in v3 if: ${{ steps.release.outputs.releases_created }} can be used to run a step conditionally. But it doesn't work in v4. Now I need to use if: ${{ steps.release.outputs.releases_created == 'true' }}

Expected behavior

if: ${{ steps.release.outputs.releases_created }} can skip steps.

Observed behavior

Steps should be skipped always run.

Action YAML

on:
  push:
    branches:
      - main
    paths:
      - 'packages/**'

name: release

jobs:
  release-please:
    runs-on: ubuntu-latest
    steps:
      - uses: google-github-actions/release-please-action@v4
        id: release
        with:
          target-branch: main
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
          registry-url: https://npm.pkg.github.com/
      - uses: pnpm/action-setup@v2
        with:
          version: 8
      - run: pnpm i
        if: ${{ steps.release.outputs.releases_created }}
      - run: pnpm run build
        if: ${{ steps.release.outputs.releases_created }}
      - name: publish to registry
        run: pnpm run publish:all
        if: ${{ steps.release.outputs.releases_created }}
        env:
          NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

Log output

No response

Additional information

Maybe this is not a bug, but it's not mentioned in the migration guide. Maybe we can add something about this. Also, manifest-releaser should be updated.

rowanmanning commented 10 months ago

This is also breaking my actions when I upgrade from v3 to v4. I've identified where the bug was introduced and have raised a PR.

toddbaert commented 10 months ago

Commenting to bring attention to this issue. The docs indicate that this should be a boolean.

Thanks a lot @rowanmanning for reporting and opening a fix for this issue!

rowanmanning commented 9 months ago

Hi again, hope you enjoyed the festive season if you celebrate! Just chasing to see if any project maintainers have had time to look into this issue yet?

I can see from the linked issues above that several open source projects have started changing their config to use the new behaviour which complicates things – the fix in my PR will break the builds of the above projects now that they've switched to expecting releases_created to be the string "true".

The longer we leave this in place the more projects are likely to break if/when a fix is rolled out. It'd be nice even to just have confirmation that this is expected behaviour so I can update my projects to use v4 of the action.

toddbaert commented 9 months ago

The longer we leave this in place the more projects are likely to break if/when a fix is rolled out. It'd be nice even to just have confirmation that this is expected behaviour so I can update my projects to use v4 of the action.

100%. I think this is plainly a bug, and the longer it waits to be reverted, the more projects will adapt to the "bugged" behavior.

toddbaert commented 9 months ago

Is there any hope of the PR associated with this issue being merged soon?

leveesean commented 7 months ago

Yikes, I just figured this out the hard way after banging my head against this for three hours. Very unfortunate bug for anyone who upgraded from v3 to v4 without paying close attention to when their steps were running. In my case, this would have resulted in running our full production deploy every time a feature or bugfix were to get merged to main.

For now I guess the best solution is to use fromJSON in my github action like described in this article. I think this will future proof my workflow in the event that this does eventually get fixed.

jimeh commented 5 months ago

Any movement or plans to fix this? The bug label was removed by a bot last week, so it seems this issue might need to have the new type: bug label added here to avoid it slipping between the cracks.

I've been holding off on the v4 upgrade across +40 repos because of this bug, and I'd rather not have to add a workaround that I might need to remove later.

artursudnik commented 2 months ago

wow...

shaunxu commented 1 week ago

I think this is a bug in Github Actions not release-please. See this issue. And a workaround, like @leveesean mentioned, using fromJson to wrap the boolean value from the outputs, something like if: ${{ fromJson(steps.release.outputs.releases_created) }}.

rowanmanning commented 1 week ago

I think this is a bug in Github Actions not release-please...

It's definitely a bug in the Release Please action, or at least an undocumented breaking change. If you upgrade from v3 to v4 of the action then your workflows behave differently, in a way that's not documented anywhere except this issue.

FWIW I've stopped using this GitHub action because of how long this issue has been open with no response.

I suspect it's now been left too long to fix so the best we can hope for is the maintainers to accept they introduced a breaking change and document it so we can move on.