Skip to content

fix(ci): Update existing flake.lock PR if it exists already#468

Merged
volodymyrZotov merged 1 commit into
mainfrom
mrj/467/flake-lock-update-ci
Aug 25, 2025
Merged

fix(ci): Update existing flake.lock PR if it exists already#468
volodymyrZotov merged 1 commit into
mainfrom
mrj/467/flake-lock-update-ci

Conversation

@mrjones2014

Copy link
Copy Markdown
Member

Overview

If a flake.lock automated PR already exists and hasn't been merged by the time a new job runs to create a new PR, it updates the existing PR instead of trying to create a new PR and failing because the branch already exists.

Type of change

  • Created a new plugin
  • Improved an existing plugin
  • Fixed a bug in an existing plugin
  • Improved contributor utilities or experience

Related Issue(s)

How To Test

Read the changed bash script and ensure it makes sense. You can also test out the logic locally on a test repo. The thinking in the first few lines (the first if block) is:

  • If the branch already exists on remote, checkout and pull before trying to update flake.lock (this is to ensure we can push new changes, e.g. a commit exists on remote that we don't have locally)
  • Otherwise, create the branch and push the empty branch to remote
  • Then run nix flake update, which now runs on the latest version of the file from the branch
  • Push the changes to the branch
    • If the branch already existed and had a PR for it, pushing new commits to the branch will update the existing PR

Changelog

Update flake.lock CI automation to update existing PR if there is one.

@edif2008 edif2008 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for your contribution! 😄

This definitely looks like a great improvement that we should have to keep things nice and clean.

@mrjones2014

Copy link
Copy Markdown
Member Author

Heh, I kinda forgot about this. We should probably try to merge this soon as our flake.lock has not been updated in quite a while.

@volodymyrZotov
volodymyrZotov merged commit 0b021e2 into main Aug 25, 2025
@volodymyrZotov
volodymyrZotov deleted the mrj/467/flake-lock-update-ci branch August 25, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: flake.lock update job should update the existing PR if an unmerged one exists

3 participants