diff --git a/.github/workflows/prepare-patch-release.yml b/.github/workflows/prepare-patch-release.yml index e4f8e38df502..237d3f87e186 100644 --- a/.github/workflows/prepare-patch-release.yml +++ b/.github/workflows/prepare-patch-release.yml @@ -88,6 +88,15 @@ jobs: git config --global user.email '32066757+storybook-bot@users.noreply.github.com' yarn release:pick-patches + - name: Cancel when 0 picked + if: steps.pick-patches.outputs.pr-count == '0' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # From https://stackoverflow.com/a/75809743 + run: | + gh run cancel ${{ github.run_id }} + gh run watch ${{ github.run_id }} + - name: Bump version deferred id: bump-version if: steps.unreleased-changes.outputs.has-changes-to-release == 'true' diff --git a/scripts/release/pick-patches.ts b/scripts/release/pick-patches.ts index eab1743dcc7b..ef31087ef976 100644 --- a/scripts/release/pick-patches.ts +++ b/scripts/release/pick-patches.ts @@ -48,6 +48,10 @@ export const run = async (_: unknown) => { spinner.warn('No PRs found.'); } + if (process.env.GITHUB_ACTIONS === 'true') { + setOutput('pr-count', JSON.stringify(patchPRs.length)); + } + const failedCherryPicks: string[] = []; // eslint-disable-next-line no-restricted-syntax