https://pantsbuild.org/ logo
p

proud-dentist-22844

03/31/2023, 7:11 PM
Could a github admin please delete my cherry-pick branches? I will push to my fork for future cherry picks. Sorry: https://github.com/pantsbuild/pants/branches ā€¢ cherry-pick-18610-to-2.16.x ā€¢ cherry-pick-18619-to-2.16.x
āœ… 1
e

enough-analyst-54434

03/31/2023, 7:21 PM
That does not appear to be trivially possible:
Copy code
$ git push upstream :cherry-pick-18610-to-2.16.x
remote: error: GH006: Protected branch update failed for refs/heads/cherry-pick-18610-to-2.16.x.
remote: error: Cannot delete this branch
To <https://github.com/pantsbuild/pants>
 ! [remote rejected]       cherry-pick-18610-to-2.16.x (protected branch hook declined)
error: failed to push some refs to '<https://github.com/pantsbuild/pants>'
I'll temporarily disable branch protection / do it / re-enable.
p

proud-dentist-22844

03/31/2023, 7:22 PM
sorry šŸ˜ž Thank you
f

fast-nail-55400

03/31/2023, 7:24 PM
Should those branches even be configured as protected?
p

proud-dentist-22844

03/31/2023, 7:24 PM
I'm guessing it's a glob
*.x
or similar.
e

enough-analyst-54434

03/31/2023, 7:24 PM
Yeah.
f

fast-nail-55400

03/31/2023, 7:24 PM
yeah I'm thinking maybe the branch protection rule if it is regex should be rooted with
^
and
$
e

enough-analyst-54434

03/31/2023, 7:25 PM
I'm reading up on syntax to see if I can do better 1st. Appears to only accept simple globs not regex.
p

proud-dentist-22844

03/31/2023, 7:26 PM
Then the thing to do might be 2 globs:
1.*.x
and
2.*.x
e

enough-analyst-54434

03/31/2023, 7:27 PM
Reading is the right thing to do. They use this: https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch I'll fix it.
f

fast-nail-55400

03/31/2023, 7:28 PM
ah ruby
(says the person working at a Ruby on Rails shop...)
you could do
[1-2].*.x
e

enough-analyst-54434

03/31/2023, 7:32 PM
Done and done. @proud-dentist-22844 did you use Josh's script for this or hand-roll the PR?
I hand roll and would never hit this issue but if the script makes it easier, its naming pattern could also be fixed, say by sticking in a directory.
p

proud-dentist-22844

03/31/2023, 7:35 PM
I used the script which delegates to
gh
to push the branch. When prompted, I selected pushing to pantsbuild/pants instead of my fork. That said, changing the branch name it creates could resolve this. Though I did have to make one modification to the script for it to succeed: looks like github api is prefixing
app/
on author login names for some weird reason.
e

enough-analyst-54434

03/31/2023, 7:36 PM
Ok. Well, that's an option then. I'll leave it to script users to fix up. I don't like exactly this sort of automation.