Skip to content

Ensure that head Git URLs always specify a branch name #20402

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

issyl0
Copy link
Member

@issyl0 issyl0 commented Aug 10, 2025

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

  • There's a TODO on the "someday" list 1 to ensure that head Git URLs always specify a branch. So I thought I'd automate this worry by adding an audit.
  • Since resource block URLs tend to be pinned to SHAs, if indeed they are Git URLs, this audit only applies to head URLs.
  • Since head must now specify a url and branch, the head do block with only these stanzas can be condensed to the single-line head "url", branch: "branch" format.
  • Always specify a branch if we can find one. If a HEAD branch name isn't specified at all, then the user probably wants to shortcut adding one by being told what the default branch for the repo is. Otherwise they have to click the URL, look at the GitHub UI, then type the branch name into branch: "foo" syntax.

- There's a TODO on the "someday" list [1] to ensure that `head` Git
  URLs always specify a branch.
- So I thought I'd automate this worry by adding an audit.
- Since `resource` block URLs tend to be pinned to SHAs, if indeed
  they are Git URLs, this audit only applies to `head` URLs.

[1]: https://github.com/orgs/Homebrew/projects/5?pane=issue&itemId=98789749
@issyl0 issyl0 force-pushed the head-url-must-always-specify-branch branch from 34c245c to c17e016 Compare August 10, 2025 19:28
issyl0 added a commit to Homebrew/homebrew-test-bot that referenced this pull request Aug 10, 2025
- Since `head` must now specify a url and branch, the `head do` block
  with only these stanzas can be condensed to the single-line
  `head "url", branch: "branch"` format.
@issyl0 issyl0 force-pushed the head-url-must-always-specify-branch branch from c17e016 to 05b27aa Compare August 10, 2025 19:53
- If a HEAD branch name isn't specified at all, then the user probably
  wants to shortcut adding one by being told what the default branch for
  the repo is. Otherwise they have to click the URL, look at the GitHub
  UI, then type the branch name into `branch: "foo"` syntax.
@issyl0 issyl0 force-pushed the head-url-must-always-specify-branch branch from 2e5e64d to 9a49b08 Compare August 10, 2025 20:55
@issyl0
Copy link
Member Author

issyl0 commented Aug 10, 2025

Hmmm. Homebrew/homebrew-test-bot#1540 is merged and the workflow run here says it's Using Homebrew/homebrew-test-bot 39e056b (Merge pull request #1540 from Homebrew/testbottest-head-branch). And yet:

Full audit --formula homebrew/test-bot/testbottest --online --git --skip-style output
  homebrew/test-bot/testbottest
    * HEAD: Git `head` URL must specify a branch name

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.

1 participant