Use Homebrew's GitHub Actions
mainnode_modules) represents a separate Action. To use a specific Action, navigate to its corresponding subdirectory in the repository to find its implementation and usage details.repository·main·Indexed 41 days ago
https://github.com/homebrew/actionsA collection of specialized GitHub Actions used by the Homebrew project to automate workflows. Includes tools for updating packages (bump-packages, bump-formulae), managing commits (api-commit-and-push, check-commit-format), caching the Homebrew prefix (cache-homebrew-prefix), and automating GitHub issues and pull requests (create-or-update-issue, create-pull-request).
node_modules) represents a separate Action. To use a specific Action, navigate to its corresponding subdirectory in the repository to find its implementation and usage details.To speed up dependency installation, enable bundler-cache: true.
When enabled, the action:
vendor/bundle using actions/cache.vendor/bundle.bundle check and bundle install --jobs 4 --retry 3 only if necessary.Gemfile.lock (or Gemfile if lock is missing) for cache hashing.- name: Set up Ruby with Bundler cache
uses: Homebrew/actions/setup-ruby@1f8e202ffddf94def7f42f6fa3a482e821489f9c
with:
setup-homebrew: true
bundler-cache: trueThe action manages the checkout of homebrew/brew based on the type of repository being tested:
brew and non-tap repositories: homebrew/brew is checked out at the latest stable tag.brew and tap repositories: homebrew/brew stays on the main branch by default. To use a stable tag for these repository types, set stable: true explicitly in the action configuration.The label-pull-requests action automatically labels pull requests based on defined criteria. It evaluates the files changed in the PR, the content of those files, and the PR body. Crucially, it will also remove labels from a pull request that no longer satisfy the defined criteria.
You can provide the labeling definitions (def) using either a JSON array or a YAML list. Both formats require a token (typically a GitHub API token) to perform the labeling operations.
- name: Label PR
uses: Homebrew/actions/label-pull-requests@1f8e202ffddf94def7f42f6fa3a482e821489f9c
with:
token: ${{secrets.HOMEBREW_GITHUB_API_TOKEN}}
def: |
- label: example-label
path: Formula/.+The failures-summary-and-bottle-result action dumps logs generated by brew test-bot. It is typically used in a workflow step with if: always() to ensure that failure summaries are captured even if previous steps in the job failed.
| Option | Description |
|---|---|
workdir | The working directory where the action should run. Defaults to ${{ github.workspace }}. |
result_path | The path to the file containing the results (e.g., bottles/steps_output.txt). |
step_name | The name displayed for the step in the GitHub Actions UI. |
collapse | Whether to collapse the output in the GitHub Actions summary. Set to 'true' to enable. |
- name: Failures summary and bottle result
if: always()
uses: Homebrew/actions/failures-summary-and-bottle-result@1f8e202ffddf94def7f42f6fa3a482e821489f9c # 2026.07.10.1
with:
workdir: ${{ github.workspace }}
result_path: bottles/steps_output.txt
step_name: 'Build failure summary on ${{ matrix.runner }}'
collapse: 'true'The setup-ruby action installs and configures Ruby using Homebrew. It is compatible with ubuntu and macos runners (the latter requires Homebrew to be present).
By default, the action installs the Homebrew ruby formula and adds it to the PATH. You can also choose to use Homebrew's portable Ruby, which is the same Ruby that Homebrew itself uses (brew ruby).
- name: Set up Ruby
uses: Homebrew/actions/setup-ruby@1f8e202ffddf94def7f42f6fa3a482e821489f9cThe api-commit-and-push action commits and pushes changes to a repository using the GitHub API instead of the standard git CLI. This is specifically useful for GitHub Apps that must use the API to ensure commits are properly signed.
To use this action, you must first obtain a token (e.g., via actions/create-github-app-token) and then provide that token, a commit message, and a target branch to the action.
- uses: actions/create-github-app-token@v3
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- run: git add some/file.txt
- uses: Homebrew/actions/api-commit-and-push@1f8e202ffddf94def7f42f6fa3a482e821489f9c # 2026.07.10.1
with:
message: Update generated files
branch: some-branch
token: ${{ steps.app-token.outputs.token }}The bump-packages action wraps brew bump to automate the process of updating outdated packages. It utilizes brew livecheck internally to identify outdated packages and can run on ubuntu (for formulae only) or macos (for formulae and casks).
If no outdated packages are detected, the action exits without performing any operations.
Important Security Note: You must use a Personal Access Token with the public_repo scope for the token input. Do not use the default GITHUB_TOKEN, as brew bump needs to create forks of tap repositories and open pull requests, which the default token cannot do.
- name: Bump packages
uses: Homebrew/actions/bump-packages@1f8e202ffddf94def7f42f6fa3a482e821489f9c # 2026.07.10.1
with:
token: ${{secrets.TOKEN}}
formulae: >
FORMULA-1
FORMULA-2
casks: >
CASK-1
CASK-2
fork: falseThe limit-pull-requests action restricts the number of open pull requests a specific user can have in a repository.
gh) and jq installed.pull_request_target workflow to ensure it has the necessary permissions to interact with pull requests.contents: readpull-requests: writepermissions:
contents: read
pull-requests: writeThe setup-homebrew action provides outputs that allow you to cache RubyGems installed by Homebrew developer commands (such as brew style).
To implement caching, use the actions/cache@v5 action with the following outputs from the setup-homebrew step:
gems-path: The path to the installed gems.gems-hash: A hash used for the cache key.After attempting to restore the cache, run brew install-bundler-gems only if a cache hit did not occur.
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@1f8e202ffddf94def7f42f6fa3a482e821489f9c
- name: Cache Homebrew Bundler RubyGems
id: cache
uses: actions/cache@v5
with:
path: ${{ steps.set-up-homebrew.outputs.gems-path }}
key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }}
restore-keys: ${{ runner.os }}-rubygems-
- name: Install Homebrew Bundler RubyGems
if: steps.cache.outputs.cache-hit != 'true'
run: brew install-bundler-gemsThe git-user-config action globally configures the Git identity (user name and email) for a specified GitHub user within a workflow run. This is useful for ensuring that commits or automated actions are attributed to a specific user rather than the default runner identity.
By default, if no username is provided, the action uses the value of the $GITHUB_ACTOR environment variable.
- name: Configure git
uses: Homebrew/actions/git-user-config@1f8e202ffddf94def7f42f6a3a482e821489f9c # 2026.07.10.1
with:
# Defaults to $GITHUB_ACTOR if not specified
username: BrewTestBotThe git-try-push action attempts to perform a git push. If the push fails (for example, due to race conditions or transient network issues), the action will wait and retry. You can control the maximum number of attempts using the tries input.
token: The GitHub token used for authentication (e.g., ${{ github.token }}).directory: The path to the repository directory where the push should be attempted.remote: The name of the remote to push to (e.g., origin).branch: The name of the branch to push to.tries: The maximum number of times to attempt the push. Defaults to a value determined by the action implementation if not specified.- name: Try pushing
uses: Homebrew/actions/git-try-push@1f8e202ffddf94def7f42f6fa3a482e821489f9c # 2026.07.10.1
with:
token: ${{github.token}}
directory: path/to/repo
remote: origin
branch: main
tries: 20