-
-
Notifications
You must be signed in to change notification settings - Fork 562
Description
Minimal repro here: https://github.com/smzelek/action-gh-release-repro
When you invoke softprops/action-gh-release multiple times in a row for the same tag, it is possible that multiple releases will be created for that tag.
Use case:
You have 5 artifacts in a repo that are all built by parallel jobs and added to the release as those build jobs complete.
Expectation:
You push tag v1. Your 5 build jobs begin running. The first to complete creates Release v1 with 1/5 of the build assets. As each job completes, they all add to Release v1.
Actual:
- If the build jobs all finish at the same time, 5 releases would be created.
- If 1 build finishes long before the others, the expected case occurs.
- If 2 builds finish first at the same time, 2 releases are created.
Explanation:
This seems to happen because the action uses the GH API to check whether a release already exists for the tag. That GH API has a delay in when it begins to show that new releases exist. So if you create a release through the GH API, then immediately afterwards attempt to query for it, it will respond that it does not exist. Because of this, the action thinks there is no release and creates a separate one.
Solution Ideas:
- Add an input parameter that specifies that you expect a release to already exist.
existingOnly: trueor something. This can expose the race condition instead of the current state where new releases are created and can silently break downstream systems when assets are missing from a release. - The action will then throw an error if no release was found, giving a nice red flag for the problem.
- Consumers of the action can then configure their own GH workflows to account for this race condition if they see it happening in their systems.