Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mrjones2014
Copy link
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.

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
1 participant