Skip to content

INFRA-2867: Skip version bump PR creation if already exists, commit in main#112

Merged
XxdpavelxX merged 2 commits into
mainfrom
INFRA-2867-FixExistingVersionBumpError
Aug 28, 2025
Merged

INFRA-2867: Skip version bump PR creation if already exists, commit in main#112
XxdpavelxX merged 2 commits into
mainfrom
INFRA-2867-FixExistingVersionBumpError

Conversation

@XxdpavelxX

@XxdpavelxX XxdpavelxX commented Aug 27, 2025

Copy link
Copy Markdown
Contributor

Ticket: https://consensyssoftware.atlassian.net/browse/INFRA-2867
Skip version bump PR creation if already exists, commit in main

The Github Action is not idempotent. We should be able to re-launch the Github Action several times successfully.

- If the version bump PR already exists, Github Action will fail (example [here](https://github.com/MetaMask/metamask-extension/actions/runs/16743685688/job/47397153780)). It needs to be deleted first before re-running the Github Action.

Error reproduced here
Fix tested here: https://github.com/consensys-test/metamask-extension-test-workflow2/actions/runs/17276145574/job/49033208400


# If the version bump branch has no commits ahead of main, skip pushing/PR creation
# right-only count gives number of commits unique to the version bump branch
ahead_count=$(git rev-list --right-only --count "${main_branch}...${version_bump_branch_name}" || echo 0)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we fallback to echo 0 here?
If git rev-list fails (e.g. due to a bad ref), this would set ahead_count=0 and the script would continue.
It seems to me that could result in hiding unexpected errors? (which I don't think we should)

@XxdpavelxX XxdpavelxX Aug 28, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, if we want to keep errors here. Then I updated the code so that after you merge the previous version-bump PR, re-running the workflow will no-op the new version-bump PR step instead of failing.

…n main

Signed-off-by: Pavel Dvorkin <pavel.dvorkin@consensys.net>

@gauthierpetetin gauthierpetetin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@XxdpavelxX XxdpavelxX merged commit 914cbff into main Aug 28, 2025
19 checks passed
@XxdpavelxX XxdpavelxX deleted the INFRA-2867-FixExistingVersionBumpError branch August 28, 2025 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants