Skip to content

Fix codeowner workflow for branches starting with "pr"#347831

Merged
philiptaron merged 1 commit intoNixOS:masterfrom
tweag:codeowners-fix-pr
Oct 11, 2024
Merged

Fix codeowner workflow for branches starting with "pr"#347831
philiptaron merged 1 commit intoNixOS:masterfrom
tweag:codeowners-fix-pr

Conversation

@infinisil
Copy link
Member

Turns out if : is passed, a local branch is updated, which can conflict if the PR branch starts with "pr". I tried to avoid that with the original code but apparently that didn't work!

https://github.com/NixOS/nixpkgs/actions/runs/11284183639/job/31384967152?pr=347822

Fetching the PR commit history
From https://github.com/linj-fork/nixpkgs
 * [new branch]            pr/kanata-add-version-check -> fork/pr
error: cannot lock ref 'refs/remotes/fork/pr/kanata-add-version-check': 'refs/remotes/fork/pr' exists; cannot create 'refs/remotes/fork/pr/kanata-add-version-check'
 ! [new branch]            pr/kanata-add-version-check -> fork/pr/kanata-add-version-check  (unable to update local ref)
error: some local refs could not be updated; try running

Thanks for the report, @jian-lin!

Things done

Successfully ran it locally with dry mode:

$ nix-build ci -A requestReviews
$ DRY_MODE=1 result/bin/request-reviews.sh NixOS/nixpkgs 347822 ci/OWNERS
[...]
Fetching the PR commit history
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 1 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (1/1), 395 bytes | 395.00 KiB/s, done.
From https://github.com/linj-fork/nixpkgs
 * branch                      pr/kanata-add-version-check -> FETCH_HEAD
 * [new branch]                pr/kanata-add-version-check -> fork/pr/kanata-add-version-check
Checking correctness of the base branch
[...]

This work is sponsored by Antithesis

Add a 👍 reaction to pull requests you find important.

Turns out if :<something> is passed, a local branch is updated, which
can conflict if the PR branch starts with "pr". I tried to avoid that
with the original code but apparently that didn't work!

https://github.com/NixOS/nixpkgs/actions/runs/11284183639/job/31384967152?pr=347822

    Fetching the PR commit history
    From https://github.com/linj-fork/nixpkgs
     * [new branch]            pr/kanata-add-version-check -> fork/pr
    error: cannot lock ref 'refs/remotes/fork/pr/kanata-add-version-check': 'refs/remotes/fork/pr' exists; cannot create 'refs/remotes/fork/pr/kanata-add-version-check'
     ! [new branch]            pr/kanata-add-version-check -> fork/pr/kanata-add-version-check  (unable to update local ref)
    error: some local refs could not be updated; try running
@jian-lin
Copy link
Contributor

conflict if the PR branch starts with "pr"

FWIW, starting with "pr/" caused failure. However, starting with "pr-" is fine.

@infinisil
Copy link
Member Author

Yeah it looks like / creates nested directories in the file system, so pr/foo and pr would try to create two files at those locations, which obviously doesn't work, which is why - is fine :)

But yeah that's definitely a bug in the code here

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Oct 11, 2024
@philiptaron philiptaron merged commit e857941 into NixOS:master Oct 11, 2024
Copy link
Contributor

@jian-lin jian-lin left a comment

Choose a reason for hiding this comment

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

Oh, this PR is merged during my review.

@infinisil infinisil deleted the codeowners-fix-pr branch October 12, 2024 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants