intuit / intuit/auto

Potential race condition when getting PR labels for releasing

Open
#2,482 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.5k
Forks
221
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

[The `label` function](https://github.com/intuit/auto/blob/c6961698ab27ac61b1a0f44a9e20785d5ae11e88/packages/core/src/auto.ts#L899) by default gets the labels from the most recently merged PR on any branch, not the most recently merged PR on the target branch. This can cause a potential race condition messing up releases.

For example:

1. PR A is merged into `master`, awaiting a release to be generated.
2. PR B is merged into `next` immediately after, with a `skip-release` label.
3. When `auto` is run for PR A, it picks up the `skip-release` label from PR B, thus not end up creating a release.

This issue will happen for any project with multiple release tracks.

**To Reproduce**

Repeat the above steps, and observe that the release labels for PR B will be used for the release of PR A.

**Expected behavior**

When `auto` is run on a specific branch to create releases, it should only pick up PRs merged from that branch, and not any other branches.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.