iotaledger / identity.rs

Implementation of the Decentralized Identity standards such as DID and Verifiable Credentials by W3C for the IOTA Tangle.
https://www.iota.org
Apache License 2.0
300 stars 87 forks source link

[Bug] Hotfix changelogs exclude PRs to dev #800

Open cycraig opened 2 years ago

cycraig commented 2 years ago

Bug description

The "Wasm Create Hotfix PR" GitHub Action fails to include changelog entries on a support/* branch when those PRs were made to the dev branch.

Cause

The cause of this bug is due to passing the --release-branch ${{ inputs.branch }} argument to github_changelog_generator:

--release-branch RELEASE-BRANCH

Limit pull requests to the release branch, such as master or release.

However, the argument was added a while ago to fix a different issue (unclear what exactly that was or if we still suffer from it): https://github.com/iotaledger/identity.rs/pull/560

The current workaround is to remove that argument in the workflow, but only in the hotfix/support branch, and to run the workflow from the support/wasm-v0.5 branch rather than dev.

Example

For the support/wasm-v0.5 branch, the dev branch commits were pushed directly to it rather than re-doing the PRs targeting the support/wasm-v0.5 branch as a base. This was done because no breaking changes were made and the PRs from those commits were intended for 0.5.1.

However, when the "Wasm Create Hotfix PR" action was executed, it failed with an error that the changelog file was unchanged. This is because it excluded the PRs to dev, even though they were made after the most recent tag, wasm-v0.5.0.

Specifically, the following PRs were not included (the rest have the No changelog label):

Steps To reproduce the bug

Explain how the maintainer can reproduce the bug.

  1. Push a PR to dev with changelog labels, e.g. Wasm, Patch.
  2. Create a hotfix branch from dev, e.g. support/wasm-v0.5.
  3. Run the "Wasm Create Hotfix PR" workflow.

Expected behaviour

"Wasm Create Hotfix PR" workflow executes without errors, including the PR from dev in the new changelog.

Actual behaviour

An error is thrown by the workflow that the changelog is unchanged, because the PR from dev is excluded.

Errors

Paste any errors that you see, including logs, errors, or screenshots.

https://github.com/iotaledger/identity.rs/runs/5855428737?check_suite_focus=true

eike-hass commented 2 years ago

This really isn't ideal but I think that is unsolvable with the github-changelog-generator library. The problem being that release-branch controls which target branch is to be considered for changes to be included. If hotfix workflows would not limit release-branch to themselves they will include all changes on dev up to the point the job is run, even if they aren't merged on the hotfix branch. The problem in the case of https://github.com/iotaledger/identity.rs/tree/support/wasm-v0.5 was that the PR was merged to dev as if it was a regular feature, it will therefore be included in the next regular changelog. To make it work with support branches another PR must be created for the support branch or vice-versa, to then be included in the hotfix changelog since then a PR targeting the support branch can be detected. Long story short: removing release-branch will include merges to dev not on the support branch. To make it work PRs must be created against support branches, sometimes requiring the same code as a PR against dev and potentially multiple support branches. A support branch must therefore be created from the commit with the associated tag not a later commit.

Edit: I believe we can close this issue, if we can live with those limitations, a the release-branch flag was only removed on the support branch.

Edit2: The https://github.com/iotaledger/identity.rs/tree/support/wasm-v0.5 might get messed up in the future if we merge more things on dev and need to run another hotfix later. We could try to recreate the branch and create another PR and retag and get it in the "right" state.