cycjimmy / semantic-release-action

GitHub Action for Semantic Release
https://github.com/marketplace/actions/action-for-semantic-release
MIT License
539 stars 98 forks source link

workflow_run causes semantic-release-action to reference wrong branch #178

Open benitazhang opened 1 year ago

benitazhang commented 1 year ago

Describe the bug When using workflow_run in a workflow that uses semantic-release-action, semantic release will reference the wrong branch and git tags.

Workflow I have 1 release branch (main) and 1 pre-release branch (development). I have workflow_run configured to wait for a test workflow to finish before triggering semantic-release

on:
  workflow_run:
    workflows:
      - Tests
    branches:
      - main
      - development
    types:
      - completed

1) main is on version v1.0.0 2) development is on version v1.0.1-development.1 3) commit message fix: typo to main and push to remote 4) observe how semantic-release incorrectly outputs Found git tag v1.0.1-development.1 associated with version v1.0.1-development.1 on branch development and There are no relevant changes, so no new version is released.

Expected behavior I would expect to see semantic-release output Found git tag v1.0.1 associated with version 1.0.1 on branch main and then to bump the version number to v1.0.1 on main

Additional context After removing workflow_run , semantic-release behaves as expected

rotivleal commented 6 months ago

+1. Seems like

env:
  GITHUB_REF: xx

does not help either.

https://github.com/semantic-release/semantic-release/issues/2704#issuecomment-1491137763

There should be a way to relay environment variables to the command itself